[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Xen-devel] [PATCH v3 11/14] AMD/IOMMU: adjust setup of internal interrupt for x2APIC mode


  • To: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>
  • From: Jan Beulich <JBeulich@xxxxxxxx>
  • Date: Mon, 22 Jul 2019 08:43:06 +0000
  • Accept-language: en-US
  • Arc-authentication-results: i=1; mx.microsoft.com 1;spf=pass smtp.mailfrom=suse.com;dmarc=pass action=none header.from=suse.com;dkim=pass header.d=suse.com;arc=none
  • Arc-message-signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=t7FapuaD/MAWLLQgTLKygLeC4EE134le1RVGaarfnrw=; b=J7GWKS5m+MtDh3+SxGp/Q/tx/ouvtg4/9CHrsmt6y9jrRy2cMkENDEMbwUPUy1+hMv42YPOO859u3fExncfbp6aQEtRa2x4KXahk0XF5G2NFN8aJBlToLxOd6gaLhzezz1BtOE0Nb82eLj5Y7Snp4a6IB8dNRyvUsIlQpYsf2ysoCX4/VY8dolYs3XZZo49FOA2kHUbek/1XZaP3583UeJtmGbPt9Ciu91JQtSEKunwEqZHo2I4SKScvcaWK5ijvuaEaauHIHUsBgaQMIRnGKvP9w1LsI0UumclHXlPgoPFEk49MoeyNvKgMBjsFzatOAxICXbF+I9yTyclmZUHvBA==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=oAKzpMgwP9Kz3TBRdfE1XQvkstgHvhGeIAvHVSulCL96hd11nG2sW58gXeKxKMhpotrJRqnHDltmIPy5Rphw+r7q+dIp8rAAkWNnm3HUD/HpkvqmmBUKcOP6mxQuO/jUsz/dEJqtXSTdVE6qf2xlXCsgtYvxffmsko6lAKGA+6KAJNiCjoDftnal6M7Pjtvs2ccS9qJMHfwMcinRISoC28MrXrcLYxghJWPhelhDWV4urzikVAbKgXky/g76mScun6ge4I/C82IhjHrdvT9b5wji910P4yNF8UwlXAx0G1P4LjhsA7F0gzql/EBbLNtTrj0n4kCVibb8c+bfJINwyw==
  • Authentication-results: spf=none (sender IP is ) smtp.mailfrom=JBeulich@xxxxxxxx;
  • Cc: "xen-devel@xxxxxxxxxxxxxxxxxxxx" <xen-devel@xxxxxxxxxxxxxxxxxxxx>, Brian Woods <brian.woods@xxxxxxx>, Suravee Suthikulpanit <suravee.suthikulpanit@xxxxxxx>
  • Delivery-date: Mon, 22 Jul 2019 08:43:42 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>
  • Thread-index: AQHVO/UbJkaZtm8uukmP929dCLxvuabSN7F4gAQjVAA=
  • Thread-topic: [PATCH v3 11/14] AMD/IOMMU: adjust setup of internal interrupt for x2APIC mode

On 19.07.2019 19:31, Andrew Cooper wrote:
> On 16/07/2019 17:39, Jan Beulich wrote:
>> --- a/xen/include/asm-x86/hvm/svm/amd-iommu-defs.h
>> +++ b/xen/include/asm-x86/hvm/svm/amd-iommu-defs.h
>> @@ -416,6 +416,25 @@ union amd_iommu_ext_features {
>>        } flds;
>>    };
>>    
>> +/* x2APIC Control Registers */
>> +#define IOMMU_XT_INT_CTRL_MMIO_OFFSET               0x0170
>> +#define IOMMU_XT_PPR_INT_CTRL_MMIO_OFFSET   0x0178
>> +#define IOMMU_XT_GA_INT_CTRL_MMIO_OFFSET    0x0180
>> +
>> +union amd_iommu_x2apic_control {
>> +    uint64_t raw;
>> +    struct {
>> +        unsigned int :2;
>> +        unsigned int dest_mode:1;
>> +        unsigned int :5;
>> +        unsigned int dest_lo:24;
>> +        unsigned int vector:8;
>> +        unsigned int int_type:1; /* DM in IOMMU spec 3.04 */
>> +        unsigned int :15;
>> +        unsigned int dest_hi:8;
> 
> Bool bitfields like you've done elsewhere in v3?

I'd been considering this, but decided against because of ...

+static void set_x2apic_affinity(struct irq_desc *desc, const cpumask_t *mask)
+{
+    struct amd_iommu *iommu = desc->action->dev_id;
+    unsigned int dest = set_desc_affinity(desc, mask);
+    union amd_iommu_x2apic_control ctrl = {};
+    unsigned long flags;
+
+    if ( dest == BAD_APICID )
+        return;
+
+    msi_compose_msg(desc->arch.vector, NULL, &iommu->msi.msg);
+    iommu->msi.msg.dest32 = dest;
+
+    ctrl.dest_mode = MASK_EXTR(iommu->msi.msg.address_lo,
+                               MSI_ADDR_DESTMODE_MASK);
+    ctrl.int_type = MASK_EXTR(iommu->msi.msg.data,
+                              MSI_DATA_DELIVERY_MODE_MASK);

... this: We really mean a value copy here, not an "is zero" or
"is non-zero" one. I also think that both fields are not suitably
named for being boolean. In the recent re-work of struct
IO_APIC_route_entry (ca9310b24e) similar fields similarly were
left as "unsigned int". MSI's struct msg_data also falls into the
same category. I think if we wanted to switch to bool here, we
should do so everywhere at the same time (along with suitably
renaming fields).

Jan
_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxxx
https://lists.xenproject.org/mailman/listinfo/xen-devel

 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.