From: Jan Beulich <jbeulich@suse.com>
To: "Roger Pau Monné" <roger.pau@citrix.com>,
"Rahul Singh" <Rahul.Singh@arm.com>
Cc: Julien Grall <julien@xen.org>,
xen-devel <xen-devel@lists.xenproject.org>,
Bertrand Marquis <Bertrand.Marquis@arm.com>,
Andrew Cooper <andrew.cooper3@citrix.com>, Wei Liu <wl@xen.org>,
George Dunlap <george.dunlap@citrix.com>,
Ian Jackson <iwj@xenproject.org>,
Stefano Stabellini <sstabellini@kernel.org>,
Paul Durrant <paul@xen.org>,
Volodymyr Babchuk <Volodymyr_Babchuk@epam.com>,
Daniel De Graaf <dgdegra@tycho.nsa.gov>
Subject: Re: [PATCH v2] xen/pci: Refactor PCI MSI interrupts related code
Date: Wed, 21 Apr 2021 11:32:16 +0200 [thread overview]
Message-ID: <e97b4e49-2655-a796-a298-d9ce5219c21f@suse.com> (raw)
In-Reply-To: <YH/fQpgEQyhiaj1Y@Air-de-Roger>
On 21.04.2021 10:16, Roger Pau Monné wrote:
> On Wed, Apr 21, 2021 at 08:07:08AM +0000, Rahul Singh wrote:
>> Hi Jan,
>>
>>> On 20 Apr 2021, at 4:36 pm, Jan Beulich <jbeulich@suse.com> wrote:
>>>
>>> On 20.04.2021 15:45, Rahul Singh wrote:
>>>>> On 19 Apr 2021, at 1:33 pm, Jan Beulich <jbeulich@suse.com> wrote:
>>>>> On 19.04.2021 13:54, Julien Grall wrote:
>>>>>> For the time being, I think move this code in x86 is a lot better than
>>>>>> #ifdef or keep the code in common code.
>>>>>
>>>>> Well, I would perhaps agree if it ended up being #ifdef CONFIG_X86.
>>>>> I would perhaps not agree if there was a new CONFIG_* which other
>>>>> (future) arch-es could select if desired.
>>>>
>>>> I agree with Julien moving the code to x86 file as currently it is referenced only in x86 code
>>>> and as of now we are not sure how other architecture will implement the Interrupt remapping
>>>> (via IOMMU or any other means).
>>>>
>>>> Let me know if you are ok with moving the code to x86.
>>>
>>> I can't answer this with "yes" or "no" without knowing what the alternative
>>> would be. As said, if the alternative is CONFIG_X86 #ifdef-ary, then yes.
>>> If a separate CONFIG_* gets introduced (and selected by X86), then a
>>> separate file (getting built only when that new setting is y) would seem
>>> better to me.
>>
>> I just made a quick patch. Please let me know if below patch is ok. I move the definition to "passthrough/x86/iommu.c” file.
>>
>> diff --git a/xen/drivers/passthrough/pci.c b/xen/drivers/passthrough/pci.c
>> index 705137f8be..199ce08612 100644
>> --- a/xen/drivers/passthrough/pci.c
>> +++ b/xen/drivers/passthrough/pci.c
>> @@ -1303,13 +1303,6 @@ static int __init setup_dump_pcidevs(void)
>> }
>> __initcall(setup_dump_pcidevs);
>>
>> -int iommu_update_ire_from_msi(
>> - struct msi_desc *msi_desc, struct msi_msg *msg)
>> -{
>> - return iommu_intremap
>> - ? iommu_call(&iommu_ops, update_ire_from_msi, msi_desc, msg) : 0;
>> -}
>> -
>> static int iommu_add_device(struct pci_dev *pdev)
>> {
>> const struct domain_iommu *hd;
>> diff --git a/xen/drivers/passthrough/x86/iommu.c b/xen/drivers/passthrough/x86/iommu.c
>> index b90bb31bfe..cf51dec564 100644
>> --- a/xen/drivers/passthrough/x86/iommu.c
>> +++ b/xen/drivers/passthrough/x86/iommu.c
>> @@ -340,6 +340,13 @@ bool arch_iommu_use_permitted(const struct domain *d)
>> likely(!p2m_get_hostp2m(d)->global_logdirty));
>> }
>>
>> +int iommu_update_ire_from_msi(
>> + struct msi_desc *msi_desc, struct msi_msg *msg)
>> +{
>> + return iommu_intremap
>> + ? iommu_call(&iommu_ops, update_ire_from_msi, msi_desc, msg) : 0;
>> +}
>> +
>> /*
>> * Local variables:
>> * mode: C
>> diff --git a/xen/include/xen/iommu.h b/xen/include/xen/iommu.h
>> index ea0cd0f1a2..bd42d87b72 100644
>> --- a/xen/include/xen/iommu.h
>> +++ b/xen/include/xen/iommu.h
>> @@ -243,7 +243,6 @@ struct iommu_ops {
>> u8 devfn, device_t *dev);
>> #ifdef CONFIG_HAS_PCI
>> int (*get_device_group_id)(u16 seg, u8 bus, u8 devfn);
>> - int (*update_ire_from_msi)(struct msi_desc *msi_desc, struct msi_msg *msg);
>> #endif /* HAS_PCI */
>>
>> void (*teardown)(struct domain *d);
>> @@ -272,6 +271,7 @@ struct iommu_ops {
>> int (*adjust_irq_affinities)(void);
>> void (*sync_cache)(const void *addr, unsigned int size);
>> void (*clear_root_pgtable)(struct domain *d);
>> + int (*update_ire_from_msi)(struct msi_desc *msi_desc, struct msi_msg *msg);
>
> You also need to move the function prototype
> (iommu_update_ire_from_msi) from iommu.h into asm-x86/iommu.h,
The prototype can, in principle at least, remain where it is.
> or maybe you could just define the function itself as static inline in
> asm-x86/iommu.h?
Possibly (and in that case it would perhaps indeed be better to
move it there, compared to needing another #ifdef).
Jan
next prev parent reply other threads:[~2021-04-21 9:32 UTC|newest]
Thread overview: 28+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-04-09 16:00 [PATCH v2] xen/pci: Refactor PCI MSI interrupts related code Rahul Singh
2021-04-12 10:49 ` Roger Pau Monné
2021-04-12 11:28 ` Jan Beulich
2021-04-12 18:26 ` Rahul Singh
2021-04-12 16:28 ` Rahul Singh
2021-04-13 17:12 ` Julien Grall
2021-04-14 7:08 ` Jan Beulich
2021-04-14 8:28 ` Roger Pau Monné
2021-04-14 8:47 ` Jan Beulich
2021-04-14 8:28 ` Julien Grall
2021-04-14 8:05 ` Roger Pau Monné
2021-04-14 8:49 ` Julien Grall
2021-04-15 13:26 ` Roger Pau Monné
2021-04-15 13:31 ` Julien Grall
2021-04-19 7:16 ` Rahul Singh
2021-04-19 8:40 ` Roger Pau Monné
2021-04-19 11:16 ` Jan Beulich
2021-04-19 11:54 ` Julien Grall
2021-04-19 12:33 ` Jan Beulich
2021-04-20 13:45 ` Rahul Singh
2021-04-20 15:36 ` Jan Beulich
2021-04-21 8:07 ` Rahul Singh
2021-04-21 8:16 ` Roger Pau Monné
2021-04-21 9:15 ` Rahul Singh
2021-04-21 9:33 ` Jan Beulich
2021-04-21 11:55 ` Rahul Singh
2021-04-21 9:32 ` Jan Beulich [this message]
2021-04-21 9:01 ` Jan Beulich
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=e97b4e49-2655-a796-a298-d9ce5219c21f@suse.com \
--to=jbeulich@suse.com \
--cc=Bertrand.Marquis@arm.com \
--cc=Rahul.Singh@arm.com \
--cc=Volodymyr_Babchuk@epam.com \
--cc=andrew.cooper3@citrix.com \
--cc=dgdegra@tycho.nsa.gov \
--cc=george.dunlap@citrix.com \
--cc=iwj@xenproject.org \
--cc=julien@xen.org \
--cc=paul@xen.org \
--cc=roger.pau@citrix.com \
--cc=sstabellini@kernel.org \
--cc=wl@xen.org \
--cc=xen-devel@lists.xenproject.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).