From: "Roger Pau Monné" <roger.pau@citrix.com>
To: Jan Beulich <jbeulich@suse.com>
Cc: "Chen, Jiqian" <Jiqian.Chen@amd.com>,
Thomas Gleixner <tglx@linutronix.de>,
Stefano Stabellini <sstabellini@kernel.org>,
Juergen Gross <jgross@suse.com>,
Oleksandr Tyshchenko <oleksandr_tyshchenko@epam.com>,
Boris Ostrovsky <boris.ostrovsky@oracle.com>,
"Rafael J . Wysocki" <rafael@kernel.org>,
Len Brown <lenb@kernel.org>, Bjorn Helgaas <bhelgaas@google.com>,
"xen-devel@lists.xenproject.org" <xen-devel@lists.xenproject.org>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
"linux-acpi@vger.kernel.org" <linux-acpi@vger.kernel.org>,
"Stabellini, Stefano" <stefano.stabellini@amd.com>,
"Deucher, Alexander" <Alexander.Deucher@amd.com>,
"Koenig, Christian" <Christian.Koenig@amd.com>,
"Hildebrand, Stewart" <Stewart.Hildebrand@amd.com>,
"Ragiadakou, Xenia" <Xenia.Ragiadakou@amd.com>,
"Huang, Honglei1" <Honglei1.Huang@amd.com>,
"Zhang, Julia" <Julia.Zhang@amd.com>,
"Huang, Ray" <Ray.Huang@amd.com>
Subject: Re: [RFC KERNEL PATCH v2 2/3] xen/pvh: Unmask irq for passthrough device in PVH dom0
Date: Tue, 12 Dec 2023 12:39:48 +0100 [thread overview]
Message-ID: <ZXhGhKkcmlEZOpwZ@macbook> (raw)
In-Reply-To: <c5d4e8a4-b286-4352-bf96-a67cb132b452@suse.com>
On Tue, Dec 12, 2023 at 12:19:49PM +0100, Jan Beulich wrote:
> On 12.12.2023 12:18, Roger Pau Monné wrote:
> > On Tue, Dec 12, 2023 at 10:38:08AM +0100, Jan Beulich wrote:
> >> (I think the Cc list is too long here, but then I don't know who to
> >> keep and who to possibly drop.)
> >>
> >> On 12.12.2023 09:49, Roger Pau Monné wrote:
> >>> On Tue, Dec 12, 2023 at 06:16:43AM +0000, Chen, Jiqian wrote:
> >>>> On 2023/12/11 23:45, Roger Pau Monné wrote:
> >>>>> On Wed, Dec 06, 2023 at 06:07:26AM +0000, Chen, Jiqian wrote:
> >>>>>> +static int xen_pvh_setup_gsi(gsi_info_t *gsi_info)
> >>>>>> +{
> >>>>>> + struct physdev_setup_gsi setup_gsi;
> >>>>>> +
> >>>>>> + setup_gsi.gsi = gsi_info->gsi;
> >>>>>> + setup_gsi.triggering = (gsi_info->trigger == ACPI_EDGE_SENSITIVE ? 0 : 1);
> >>>>>> + setup_gsi.polarity = (gsi_info->polarity == ACPI_ACTIVE_HIGH ? 0 : 1);
> >>>>>> +
> >>>>>> + return HYPERVISOR_physdev_op(PHYSDEVOP_setup_gsi, &setup_gsi);
> >>>>>> +}
> >>>>>
> >>>>> Hm, why not simply call pcibios_enable_device() from pciback? What
> >>>> pcibios_enable_device had been called when using cmd "xl pci-assignable-add sbdf" from pciback. But it didn't do map_pirq and setup_gsi.
> >>>> Because pcibios_enable_device-> pcibios_enable_irq-> __acpi_register_gsi(acpi_register_gsi_ioapic PVH specific)
> >>>>> you are doing here using the hypercalls is a backdoor into what's done
> >>>>> automatically by Xen on IO-APIC accesses by a PVH dom0.
> >>>> But the gsi didn't be unmasked, and vioapic_hwdom_map_gsi is never called.
> >>>> So, I think in pciback, if we can do what vioapic_hwdom_map_gsi does.
> >>>>
> >>>
> >>> I see, it does setup the IO-APIC pin but doesn't unmask it, that's
> >>> what I feared.
> >>>
> >>>>> It will be much more natural for the PVH dom0 model to simply use the
> >>>>> native way to configure and unmask the IO-APIC pin, and that would
> >>>>> correctly setup the triggering/polarity and bind it to dom0 without
> >>>>> requiring the usage of any hypercalls.
> >>>> Do you still prefer that I called unmask_irq in pcistub_init_device, as this v2 patch do?
> >>>> But Thomas Gleixner think it is not suitable to export unmask_irq.
> >>>
> >>> Yeah, that wasn't good.
> >>>
> >>>>>
> >>>>> Is that an issue since in that case the gsi will get mapped and bound
> >>>>> to dom0?
> >>>> Dom0 do map_pirq is to pass the check xc_domain_irq_permission()-> pirq_access_permitted(),
> >>>
> >>> Can we see about finding another way to fix this check?
> >>>
> >>> One option would be granting permissions over the IRQ in
> >>> PHYSDEVOP_setup_gsi?
> >>
> >> There's no domain available there, and imo it's also the wrong interface to
> >> possibly grant any permissions.
> >
> > Well, the domain is the caller.
>
> Granting permission to itself?
See below in the previous email, the issue is not with the
permissions, which are correctly assigned from
dom0_setup_permissions(), but the usage of domain_pirq_to_irq() in
pirq_access_permitted() as called by XEN_DOMCTL_irq_permission.
There's no need to play with the permissions at all.
Regards, Roger.
next prev parent reply other threads:[~2023-12-12 11:39 UTC|newest]
Thread overview: 42+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-11-24 10:31 [RFC KERNEL PATCH v2 0/3] Support device passthrough when dom0 is PVH on Xen Jiqian Chen
2023-11-24 10:31 ` [RFC KERNEL PATCH v2 1/3] xen/pci: Add xen_reset_device_state function Jiqian Chen
2023-11-30 3:46 ` Stefano Stabellini
2023-11-30 7:03 ` Chen, Jiqian
2023-11-30 15:03 ` Stewart Hildebrand
2023-12-04 3:25 ` Chen, Jiqian
2023-12-04 3:45 ` Stewart Hildebrand
2023-12-04 7:58 ` Thomas Gleixner
2023-12-04 8:49 ` Chen, Jiqian
2023-12-04 21:31 ` Stefano Stabellini
2023-12-05 6:50 ` Chen, Jiqian
2023-12-05 17:02 ` Thomas Gleixner
2023-12-06 6:37 ` Chen, Jiqian
2023-11-24 10:31 ` [RFC KERNEL PATCH v2 2/3] xen/pvh: Unmask irq for passthrough device in PVH dom0 Jiqian Chen
2023-11-30 3:53 ` Stefano Stabellini
2023-11-30 16:02 ` Roger Pau Monné
2023-12-01 3:15 ` Stefano Stabellini
2023-12-01 8:58 ` Roger Pau Monné
2023-12-02 3:37 ` Stefano Stabellini
2023-12-04 10:28 ` Roger Pau Monné
2023-12-04 22:19 ` Stefano Stabellini
2023-12-05 9:19 ` Roger Pau Monné
2023-12-05 9:39 ` Chen, Jiqian
2023-12-05 10:32 ` Jan Beulich
2023-12-06 6:07 ` Chen, Jiqian
2023-12-07 2:18 ` Stefano Stabellini
2023-12-07 3:38 ` Chen, Jiqian
2023-12-07 6:43 ` Juergen Gross
2023-12-08 5:53 ` Chen, Jiqian
2023-12-11 15:45 ` Roger Pau Monné
2023-12-12 6:16 ` Chen, Jiqian
2023-12-12 8:49 ` Roger Pau Monné
2023-12-12 9:38 ` Jan Beulich
2023-12-12 11:18 ` Roger Pau Monné
2023-12-12 11:19 ` Jan Beulich
2023-12-12 11:39 ` Roger Pau Monné [this message]
2023-12-13 7:14 ` Chen, Jiqian
2023-12-13 7:41 ` Jan Beulich
2023-12-05 6:46 ` Chen, Jiqian
2023-12-04 8:13 ` Thomas Gleixner
2023-12-05 7:03 ` Chen, Jiqian
2023-11-24 10:31 ` [RFC KERNEL PATCH v2 3/3] xen/privcmd: Add new syscall to get gsi from irq Jiqian Chen
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=ZXhGhKkcmlEZOpwZ@macbook \
--to=roger.pau@citrix.com \
--cc=Alexander.Deucher@amd.com \
--cc=Christian.Koenig@amd.com \
--cc=Honglei1.Huang@amd.com \
--cc=Jiqian.Chen@amd.com \
--cc=Julia.Zhang@amd.com \
--cc=Ray.Huang@amd.com \
--cc=Stewart.Hildebrand@amd.com \
--cc=Xenia.Ragiadakou@amd.com \
--cc=bhelgaas@google.com \
--cc=boris.ostrovsky@oracle.com \
--cc=jbeulich@suse.com \
--cc=jgross@suse.com \
--cc=lenb@kernel.org \
--cc=linux-acpi@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=oleksandr_tyshchenko@epam.com \
--cc=rafael@kernel.org \
--cc=sstabellini@kernel.org \
--cc=stefano.stabellini@amd.com \
--cc=tglx@linutronix.de \
--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