All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jan Beulich <jbeulich@suse.com>
To: "xen-devel@lists.xenproject.org" <xen-devel@lists.xenproject.org>
Cc: "Andrew Cooper" <andrew.cooper3@citrix.com>,
	"Wei Liu" <wl@xen.org>, "Roger Pau Monné" <roger.pau@citrix.com>
Subject: [PATCH] x86/PV: use altcall for I/O emulation quirk hook
Date: Tue, 16 Jan 2024 17:58:58 +0100	[thread overview]
Message-ID: <5f7afa11-3216-4175-b05b-3ff78920fa00@suse.com> (raw)

This way we can arrange for ioemul_handle_proliant_quirk()'s ENDBR to
also be zapped. Utilize existing data rather than introducing another
otherwise unused static variable (array); eventually (if any new quirk
was in need of adding) we may want to use .callback and .driver_data
anyway.

For the decision to be taken before the 2nd alternative patching pass,
the initcall needs to become a pre-SMP one.

While touching this code, also arrange for it to not be built at all
when !PV - that way the respective ENDBR won't be there from the
beginning.

Signed-off-by: Jan Beulich <jbeulich@suse.com>
---
Obviously the file may want moving to pv/ then. I wasn't sure whether
to also fold doing so right into here.

--- a/xen/arch/x86/Makefile
+++ b/xen/arch/x86/Makefile
@@ -45,7 +45,7 @@ obj-$(CONFIG_LIVEPATCH) += alternative.o
 obj-y += msi.o
 obj-y += msr.o
 obj-$(CONFIG_INDIRECT_THUNK) += indirect-thunk.o
-obj-y += ioport_emulate.o
+obj-$(CONFIG_PV) += ioport_emulate.o
 obj-y += irq.o
 obj-$(CONFIG_KEXEC) += machine_kexec.o
 obj-y += mm.o x86_64/mm.o
--- a/xen/arch/x86/ioport_emulate.c
+++ b/xen/arch/x86/ioport_emulate.c
@@ -36,7 +36,7 @@ static unsigned int cf_check ioemul_hand
 }
 
 /* This table is the set of system-specific I/O emulation hooks. */
-static const struct dmi_system_id __initconstrel ioport_quirks_tbl[] = {
+static const struct dmi_system_id __initconst_cf_clobber ioport_quirks_tbl[] = {
     /*
      * I/O emulation hook for certain HP ProLiant servers with
      * 'special' SMM goodness.
@@ -46,6 +46,8 @@ static const struct dmi_system_id __init
         DMI_MATCH2(
             DMI_MATCH(DMI_BIOS_VENDOR, "HP"),
             DMI_MATCH(DMI_PRODUCT_NAME, "ProLiant DL3")),
+        /* Need in one entry only as long as .callback isn't also used. */
+        .driver_data = ioemul_handle_proliant_quirk,
     },
     {
         .ident = "HP ProLiant DL5xx",
@@ -99,7 +101,7 @@ static int __init cf_check ioport_quirks
 
     return 0;
 }
-__initcall(ioport_quirks_init);
+presmp_initcall(ioport_quirks_init);
 
 /*
  * Local variables:
--- a/xen/arch/x86/pv/emul-priv-op.c
+++ b/xen/arch/x86/pv/emul-priv-op.c
@@ -112,7 +112,8 @@ static io_emul_stub_t *io_emul_stub_setu
     /* Some platforms might need to quirk the stub for specific inputs. */
     if ( unlikely(ioemul_handle_quirk) )
     {
-        quirk_bytes = ioemul_handle_quirk(opcode, p, ctxt->ctxt.regs);
+        quirk_bytes = alternative_call(ioemul_handle_quirk, opcode, p,
+                                       ctxt->ctxt.regs);
         p += quirk_bytes;
     }
 


             reply	other threads:[~2024-01-16 16:59 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-01-16 16:58 Jan Beulich [this message]
2024-01-16 17:31 ` [PATCH] x86/PV: use altcall for I/O emulation quirk hook Andrew Cooper
2024-01-17  9:18   ` 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=5f7afa11-3216-4175-b05b-3ff78920fa00@suse.com \
    --to=jbeulich@suse.com \
    --cc=andrew.cooper3@citrix.com \
    --cc=roger.pau@citrix.com \
    --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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.