lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <2a193373-ccb2-458a-890f-d48c4b724e08@intel.com>
Date:   Tue, 5 Dec 2023 08:52:14 -0700
From:   Dave Jiang <dave.jiang@...el.com>
To:     Rex Zhang <rex.zhang@...el.com>, <tom.zanussi@...ux.intel.com>
CC:     <davem@...emloft.net>, <dmaengine@...r.kernel.org>,
        <fenghua.yu@...el.com>, <giovanni.cabiddu@...el.com>,
        <herbert@...dor.apana.org.au>, <james.guilford@...el.com>,
        <kanchana.p.sridhar@...el.com>, <linux-crypto@...r.kernel.org>,
        <linux-kernel@...r.kernel.org>, <pavel@....cz>,
        <tony.luck@...el.com>, <vinodh.gopal@...el.com>,
        <vkoul@...nel.org>, <wajdi.k.feghali@...el.com>
Subject: Re: [PATCH v11 14/14] dmaengine: idxd: Add support for device/wq
 defaults



On 12/5/23 02:21, Rex Zhang wrote:
> Hi Tom,
> 
> On 2023-12-01 at 14:10:35 -0600, Tom Zanussi wrote:
> 
> [snip]
> 
>> +int idxd_load_iaa_device_defaults(struct idxd_device *idxd)
>> +{
>> +	struct idxd_engine *engine;
>> +	struct idxd_group *group;
>> +	struct idxd_wq *wq;
>> +
>> +	if (!test_bit(IDXD_FLAG_CONFIGURABLE, &idxd->flags))
>> +		return 0;
> In the virtualization case, it is not configurable in guest OS,
> then the default work queue will not be enabled. Is it expected?

I think what you can do is just set the attributes that are settable and the wq should auto enable. That may be the right approach to make it consistent with host.

>> +
>> +	wq = idxd->wqs[0];
>> +
>> +	if (wq->state != IDXD_WQ_DISABLED)
>> +		return -EPERM;
>> +
>> +	/* set mode to "dedicated" */
>> +	set_bit(WQ_FLAG_DEDICATED, &wq->flags);
>> +	wq->threshold = 0;
>> +
>> +	/* only setting up 1 wq, so give it all the wq space */
>> +	wq->size = idxd->max_wq_size;
>> +
>> +	/* set priority to 10 */
>> +	wq->priority = 10;
>> +
>> +	/* set type to "kernel" */
>> +	wq->type = IDXD_WQT_KERNEL;
>> +
>> +	/* set wq group to 0 */
>> +	group = idxd->groups[0];
>> +	wq->group = group;
>> +	group->num_wqs++;
>> +
>> +	/* set name to "iaa_crypto" */
>> +	memset(wq->name, 0, WQ_NAME_SIZE + 1);
>> +	strscpy(wq->name, "iaa_crypto", WQ_NAME_SIZE + 1);
>> +
>> +	/* set driver_name to "crypto" */
>> +	memset(wq->driver_name, 0, DRIVER_NAME_SIZE + 1);
>> +	strscpy(wq->driver_name, "crypto", DRIVER_NAME_SIZE + 1);
>> +
>> +	engine = idxd->engines[0];
>> +
>> +	/* set engine group to 0 */
>> +	engine->group = idxd->groups[0];
>> +	engine->group->num_engines++;
>> +
>> +	return 0;
>> +}
>> diff --git a/drivers/dma/idxd/idxd.h b/drivers/dma/idxd/idxd.h
>> index 62ea21b25906..47de3f93ff1e 100644
>> --- a/drivers/dma/idxd/idxd.h
>> +++ b/drivers/dma/idxd/idxd.h
>> @@ -277,6 +277,8 @@ struct idxd_dma_dev {
>>  	struct dma_device dma;
>>  };
>>  
>> +typedef int (*load_device_defaults_fn_t) (struct idxd_device *idxd);
>> +
>>  struct idxd_driver_data {
>>  	const char *name_prefix;
>>  	enum idxd_type type;
>> @@ -286,6 +288,7 @@ struct idxd_driver_data {
>>  	int evl_cr_off;
>>  	int cr_status_off;
>>  	int cr_result_off;
>> +	load_device_defaults_fn_t load_device_defaults;
>>  };
>>  
>>  struct idxd_evl {
>> @@ -730,6 +733,7 @@ void idxd_unregister_devices(struct idxd_device *idxd);
>>  void idxd_wqs_quiesce(struct idxd_device *idxd);
>>  bool idxd_queue_int_handle_resubmit(struct idxd_desc *desc);
>>  void multi_u64_to_bmap(unsigned long *bmap, u64 *val, int count);
>> +int idxd_load_iaa_device_defaults(struct idxd_device *idxd);
>>  
>>  /* device interrupt control */
>>  irqreturn_t idxd_misc_thread(int vec, void *data);
>> diff --git a/drivers/dma/idxd/init.c b/drivers/dma/idxd/init.c
>> index 0eb1c827a215..14df1f1347a8 100644
>> --- a/drivers/dma/idxd/init.c
>> +++ b/drivers/dma/idxd/init.c
>> @@ -59,6 +59,7 @@ static struct idxd_driver_data idxd_driver_data[] = {
>>  		.evl_cr_off = offsetof(struct iax_evl_entry, cr),
>>  		.cr_status_off = offsetof(struct iax_completion_record, status),
>>  		.cr_result_off = offsetof(struct iax_completion_record, error_code),
>> +		.load_device_defaults = idxd_load_iaa_device_defaults,
>>  	},
>>  };
>>  
>> @@ -745,6 +746,12 @@ static int idxd_pci_probe(struct pci_dev *pdev, const struct pci_device_id *id)
>>  		goto err;
>>  	}
>>  
>> +	if (data->load_device_defaults) {
>> +		rc = data->load_device_defaults(idxd);
>> +		if (rc)
>> +			dev_warn(dev, "IDXD loading device defaults failed\n");
>> +	}
>> +
>>  	rc = idxd_register_devices(idxd);
>>  	if (rc) {
>>  		dev_err(dev, "IDXD sysfs setup failed\n");
> 
> Thanks,
> Rex Zhang
>> -- 
>> 2.34.1
>>

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ