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

Re: [RFC XEN PATCH 6/6] tools/libs/light: pci: translate irq to gsi


  • To: Jan Beulich <jbeulich@xxxxxxxx>
  • From: Roger Pau Monné <roger.pau@xxxxxxxxxx>
  • Date: Mon, 20 Mar 2023 17:50:05 +0100
  • Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=citrix.com; dmarc=pass action=none header.from=citrix.com; dkim=pass header.d=citrix.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-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=d7UanYDhUnrqnRK0v00GLIfHsL2xnjDQWkwY6wpmlFI=; b=REfghXuEXHsf2ThaFvozAWx9008fSCDUTxz6JcXarL7lnIZqZXRRhTY+yCwFLloNeHxVmOM3Lrnm4Jwl4kcK5ivXPyoChDEdImgZr0OUguxy1oWb4e6aPPuwpBwflW7ab4g8dRMw/OWPJSnyINA27miN7UaayN9YRJnetoIMl5ifZmNz6L9TVPzFIV2ZAi44NeaZY089ZAYY9pTQDyTJHuhEYDhOjnYt9Q28zO42RLqE13lhEAEbOUYVi+kuDbvGfJsPnja7/eE11QsRigKGzyfZS1ZWu0JyK1BZqyGof0q1Kk1ArZ9cWPPC+lQ+S6aqMj6FbXrAU34aMfxvZ5rbiw==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=bdQbEd3Xg/jzBGiuggjdeZhqaIUma19sBTB9D9JWBB6SU6Uu4QISpnLp1Zt01fZj42BmDmWJlmV1n54DiZlb6fyuXRYzc+x2avkJ3IPl8GZzaQyHF56sN70+3p5Cqi5jc1UKjfzvPZKrS8VQYwpKxcDseTaz7VaIRsyR2hGpEZCcFCYqSqNy8UekLgMIa3xKXaFikO+u6Expq/0ABehAZ5oEeq06vjiszUuL5muepdFQCazi6Mwjx+sVjllqrzRcUk0/J+V6TQvr2WFrF0/5R/z0aFmHL9DJlWgFACMI1thsJHtDUgcqBvsdEplkm620TfvRed9xPOm4o3orNZ2lxg==
  • Authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=citrix.com;
  • Cc: Huang Rui <ray.huang@xxxxxxx>, Anthony PERARD <anthony.perard@xxxxxxxxxx>, xen-devel@xxxxxxxxxxxxxxxxxxxx, Alex Deucher <alexander.deucher@xxxxxxx>, Christian König <christian.koenig@xxxxxxx>, Stewart Hildebrand <Stewart.Hildebrand@xxxxxxx>, Xenia Ragiadakou <burzalodowa@xxxxxxxxx>, Honglei Huang <honglei1.huang@xxxxxxx>, Julia Zhang <julia.zhang@xxxxxxx>, Chen Jiqian <Jiqian.Chen@xxxxxxx>, Stefano Stabellini <sstabellini@xxxxxxxxxx>
  • Delivery-date: Mon, 20 Mar 2023 16:50:32 +0000
  • Ironport-data: A9a23:O7R68Kxsvc3WW/f7l0V6t+dexirEfRIJ4+MujC+fZmUNrF6WrkVSm zROUTuAPPqDY2LxeNlya4rj8k9TvZ/WzYRlGgVkpSAxQypGp/SeCIXCJC8cHc8wwu7rFxs7s ppEOrEsCOhuExcwcz/0auCJQUFUjP3OHfykTrafYEidfCc8IA85kxVvhuUltYBhhNm9Emult Mj75sbSIzdJ4RYtWo4vw//F+UMHUMja4mtC5QRlP6gT5TcyqlFOZH4hDfDpR5fHatE88t6SH 47r0Ly/92XFyBYhYvvNfmHTKxBirhb6ZGBiu1IOM0SQqkEqSh8ai87XAME0e0ZP4whlqvgqo Dl7WT5cfi9yVkHEsLx1vxC1iEiSN4UekFPMCSDXXcB+UyQq2pYjqhljJBheAGEWxgp4KSZPr sxfFAAUVzfdhtidmLOyWPl3g/12eaEHPKtH0p1h5RfwKK9+BLrlHODN79Ie2yosjMdTG/qYf 9AedTdkcBXHZVtIJ0sTD5U92uyvgxETcRUB8A7T+fVxvDCVlVQtuFTuGIO9ltiiX8Jak1zev mvb12/4HgsbJJqUzj/tHneE37eWwXOmCdxDfFG+3qNbpHaC5D0CMRQpcmmdnceShnHkaesKf iT4/QJr98De7neDTNPwQhm5q36spQMHVpxbFOhSwBuE2+zU/g+fCUANSzIHY9sj3OcmSDpv2 lKXktfBAT10rKbTWX+b7q2Trz65JW4SN2BqTSYAQBsM5dXuusc/gw/ETtt5OKewgpv+HjSY6 zuKtiklm7Qai4gI0Ki9/F/vijeg4JPOS2Yd3RnaQWu/8kVZZYqpaoay4F7Xxf9FIMCSSVzpl HIZgdqX6OcCCo6EvCOISeQJWrqu4p6tMDrajlpiHsBn9ymk/XGLdIVcpjp5IS9BMNsAeDavc k/avwx57ZpfenCtaMdfQYOoCs0si4PgGNLNX/XYKNFJZ/BZbxSb9StjYUqR2WHFk0U2l6w7f 5CBfq6R4W0yDK1myH+8Qbgb2LpyniQmnzqLGdb80git1qeYaDiNU7AZPVCSb+c/qqSZvAHS9 NUZPMyPo/lCbNDDjuDs2dZ7BTg3wbITXvgad+Q/mja/Hzdb
  • Ironport-hdrordr: A9a23:T76ieaCKCqlbOzblHem955DYdb4zR+YMi2TDtnoddfUxSKfzqy nApoV56faKskdyZJhNo7690cq7LU80l6QU3WB5B97LYOCMggSVxe9ZjLcKygeQfhHDyg==
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

On Mon, Mar 20, 2023 at 04:29:25PM +0100, Jan Beulich wrote:
> On 20.03.2023 16:16, Roger Pau Monné wrote:
> > @@ -244,12 +242,18 @@ static void vioapic_write_redirent(
> >      }
> >      else
> >      {
> > +        int ret;
> > +
> >          unmasked = ent.fields.mask;
> >          /* Remote IRR and Delivery Status are read-only. */
> >          ent.bits = ((ent.bits >> 32) << 32) | val;
> >          ent.fields.delivery_status = 0;
> >          ent.fields.remote_irr = pent->fields.remote_irr;
> >          unmasked = unmasked && !ent.fields.mask;
> > +        ret = mp_register_gsi(gsi, ent.fields.trig_mode, 
> > ent.fields.polarity);
> > +        if ( ret && ret !=  -EEXIST )
> > +            gprintk(XENLOG_WARNING, "vioapic: error registering GSI %u: 
> > %d\n",
> > +                    gsi, ret);
> >      }
> 
> I assume this is only meant to be experimental, as I'm missing confinement
> to Dom0 here.

Indeed.  I've attached a fixed version below, let's make sure this
doesn't influence testing.

> I also question this when the mask bit as set, as in that
> case neither the trigger mode bit nor the polarity one can be relied upon.
> At which point it would look to me as if it was necessary for Dom0 to use
> a hypercall instead (which naturally would then be PHYSDEVOP_setup_gsi).

AFAICT Linux does correctly set the trigger/polarity even when the
pins are masked, so this should be safe as a proof of concept. Let's
first figure out whether the issue is really with the lack of setup of
the IO-APIC pins.  At the end without input from Ray this is just a
wild guess.

Regards, Roger.
----
diff --git a/xen/arch/x86/hvm/hypercall.c b/xen/arch/x86/hvm/hypercall.c
index 405d0a95af..cc53a3bd12 100644
--- a/xen/arch/x86/hvm/hypercall.c
+++ b/xen/arch/x86/hvm/hypercall.c
@@ -86,6 +86,8 @@ long hvm_physdev_op(int cmd, XEN_GUEST_HANDLE_PARAM(void) arg)
     {
     case PHYSDEVOP_map_pirq:
     case PHYSDEVOP_unmap_pirq:
+        break;
+
     case PHYSDEVOP_eoi:
     case PHYSDEVOP_irq_status_query:
     case PHYSDEVOP_get_free_pirq:
diff --git a/xen/arch/x86/hvm/vioapic.c b/xen/arch/x86/hvm/vioapic.c
index 41e3c4d5e4..64f7b5bcc5 100644
--- a/xen/arch/x86/hvm/vioapic.c
+++ b/xen/arch/x86/hvm/vioapic.c
@@ -180,9 +180,7 @@ static int vioapic_hwdom_map_gsi(unsigned int gsi, unsigned 
int trig,
 
     /* Interrupt has been unmasked, bind it now. */
     ret = mp_register_gsi(gsi, trig, pol);
-    if ( ret == -EEXIST )
-        return 0;
-    if ( ret )
+    if ( ret && ret != -EEXIST )
     {
         gprintk(XENLOG_WARNING, "vioapic: error registering GSI %u: %d\n",
                  gsi, ret);
@@ -250,6 +248,16 @@ static void vioapic_write_redirent(
         ent.fields.delivery_status = 0;
         ent.fields.remote_irr = pent->fields.remote_irr;
         unmasked = unmasked && !ent.fields.mask;
+        if ( is_hardware_domain(d) )
+        {
+            int ret = mp_register_gsi(gsi, ent.fields.trig_mode,
+                                      ent.fields.polarity);
+
+            if ( ret && ret !=  -EEXIST )
+                gprintk(XENLOG_WARNING,
+                        "vioapic: error registering GSI %u: %d\n",
+                        gsi, ret);
+        }
     }
 
     *pent = ent;




 


Rackspace

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