From: mhkelley58@gmail.com
To: kys@microsoft.com, haiyangz@microsoft.com, wei.liu@kernel.org,
decui@microsoft.com, tglx@linutronix.de, mingo@redhat.com,
bp@alien8.de, dave.hansen@linux.intel.com, hpa@zytor.com,
lpieralisi@kernel.org, kw@linux.com,
manivannan.sadhasivam@linaro.org, robh@kernel.org,
bhelgaas@google.com, arnd@arndb.de
Cc: x86@kernel.org, linux-hyperv@vger.kernel.org,
linux-kernel@vger.kernel.org, linux-pci@vger.kernel.org,
linux-arch@vger.kernel.org
Subject: [PATCH 6/7] PCI: hv: Use hv_hvcall_*() to set up hypercall arguments
Date: Wed, 26 Feb 2025 12:06:11 -0800 [thread overview]
Message-ID: <20250226200612.2062-7-mhklinux@outlook.com> (raw)
In-Reply-To: <20250226200612.2062-1-mhklinux@outlook.com>
From: Michael Kelley <mhklinux@outlook.com>
Update hypercall call sites to use the new hv_hvcall_*() functions
to set up hypercall arguments. Since these functions zero the
fixed portion of input memory, remove now redundant calls to memset().
Signed-off-by: Michael Kelley <mhklinux@outlook.com>
---
drivers/pci/controller/pci-hyperv.c | 14 ++++++--------
include/hyperv/hvgdk_mini.h | 2 +-
2 files changed, 7 insertions(+), 9 deletions(-)
diff --git a/drivers/pci/controller/pci-hyperv.c b/drivers/pci/controller/pci-hyperv.c
index 44d7f4339306..b7bfda00544d 100644
--- a/drivers/pci/controller/pci-hyperv.c
+++ b/drivers/pci/controller/pci-hyperv.c
@@ -638,8 +638,8 @@ static void hv_arch_irq_unmask(struct irq_data *data)
local_irq_save(flags);
- params = *this_cpu_ptr(hyperv_pcpu_input_arg);
- memset(params, 0, sizeof(*params));
+ hv_hvcall_in_array(¶ms, sizeof(*params),
+ sizeof(params->int_target.vp_set.bank_contents[0]));
params->partition_id = HV_PARTITION_ID_SELF;
params->int_entry.source = HV_INTERRUPT_SOURCE_MSI;
params->int_entry.msi_entry.address.as_uint32 = int_desc->address & 0xffffffff;
@@ -1034,11 +1034,9 @@ static void hv_pci_read_mmio(struct device *dev, phys_addr_t gpa, int size, u32
/*
* Must be called with interrupts disabled so it is safe
- * to use the per-cpu input argument page. Use it for
- * both input and output.
+ * to use the per-cpu argument page.
*/
- in = *this_cpu_ptr(hyperv_pcpu_input_arg);
- out = *this_cpu_ptr(hyperv_pcpu_input_arg) + sizeof(*in);
+ hv_hvcall_inout(&in, sizeof(*in), &out, sizeof(*out));
in->gpa = gpa;
in->size = size;
@@ -1067,9 +1065,9 @@ static void hv_pci_write_mmio(struct device *dev, phys_addr_t gpa, int size, u32
/*
* Must be called with interrupts disabled so it is safe
- * to use the per-cpu input argument memory.
+ * to use the per-cpu argument page.
*/
- in = *this_cpu_ptr(hyperv_pcpu_input_arg);
+ hv_hvcall_in_array(&in, sizeof(*in), sizeof(in->data[0]));
in->gpa = gpa;
in->size = size;
switch (size) {
diff --git a/include/hyperv/hvgdk_mini.h b/include/hyperv/hvgdk_mini.h
index 70e5d7ee40c8..cb25ac1e3ac5 100644
--- a/include/hyperv/hvgdk_mini.h
+++ b/include/hyperv/hvgdk_mini.h
@@ -1342,7 +1342,7 @@ struct hv_mmio_write_input {
u64 gpa;
u32 size;
u32 reserved;
- u8 data[HV_HYPERCALL_MMIO_MAX_DATA_LENGTH];
+ u8 data[];
} __packed;
#endif /* _HV_HVGDK_MINI_H */
--
2.25.1
next prev parent reply other threads:[~2025-02-26 20:06 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-02-26 20:06 [PATCH 0/7] hyperv: Introduce new way to manage hypercall args mhkelley58
2025-02-26 20:06 ` [PATCH 1/7] x86/hyperv: Fix output argument to hypercall that changes page visibility mhkelley58
2025-02-26 22:59 ` Nuno Das Neves
2025-03-10 0:22 ` Wei Liu
2025-02-26 20:06 ` [PATCH 2/7] Drivers: hv: Introduce hv_hvcall_*() functions for hypercall arguments mhkelley58
2025-02-27 0:14 ` Nuno Das Neves
2025-02-27 1:50 ` Michael Kelley
2025-02-27 20:09 ` Nuno Das Neves
2025-02-26 20:06 ` [PATCH 3/7] x86/hyperv: Use hv_hvcall_*() to set up hypercall arguments -- part 1 mhkelley58
2025-02-27 21:07 ` Nuno Das Neves
2025-02-28 0:50 ` Michael Kelley
2025-02-26 20:06 ` [PATCH 4/7] x86/hyperv: Use hv_hvcall_*() to set up hypercall arguments -- part 2 mhkelley58
2025-02-26 20:06 ` [PATCH 5/7] Drivers: hv: Use hv_hvcall_*() to set up hypercall arguments mhkelley58
2025-02-26 20:06 ` mhkelley58 [this message]
2025-02-27 20:29 ` [PATCH 6/7] PCI: " Bjorn Helgaas
2025-03-05 17:24 ` Wei Liu
2025-02-26 20:06 ` [PATCH 7/7] Drivers: hv: Replace hyperv_pcpu_input/output_arg with hyperv_pcpu_arg mhkelley58
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=20250226200612.2062-7-mhklinux@outlook.com \
--to=mhkelley58@gmail.com \
--cc=arnd@arndb.de \
--cc=bhelgaas@google.com \
--cc=bp@alien8.de \
--cc=dave.hansen@linux.intel.com \
--cc=decui@microsoft.com \
--cc=haiyangz@microsoft.com \
--cc=hpa@zytor.com \
--cc=kw@linux.com \
--cc=kys@microsoft.com \
--cc=linux-arch@vger.kernel.org \
--cc=linux-hyperv@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pci@vger.kernel.org \
--cc=lpieralisi@kernel.org \
--cc=manivannan.sadhasivam@linaro.org \
--cc=mhklinux@outlook.com \
--cc=mingo@redhat.com \
--cc=robh@kernel.org \
--cc=tglx@linutronix.de \
--cc=wei.liu@kernel.org \
--cc=x86@kernel.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