From: Andrew Murray <amurray@thegoodpenguin.co.uk>
To: Boqun Feng <boqun.feng@gmail.com>
Cc: linux-pci@vger.kernel.org, linux-hyperv@vger.kernel.org,
linux-kernel@vger.kernel.org,
linux-arm-kernel@lists.infradead.org,
Michael Kelley <mikelley@microsoft.com>,
"K. Y. Srinivasan" <kys@microsoft.com>,
Haiyang Zhang <haiyangz@microsoft.com>,
Stephen Hemminger <sthemmin@microsoft.com>,
Sasha Levin <sashal@kernel.org>,
Thomas Gleixner <tglx@linutronix.de>,
Ingo Molnar <mingo@redhat.com>, Borislav Petkov <bp@alien8.de>,
"H. Peter Anvin" <hpa@zytor.com>,
x86@kernel.org, Lorenzo Pieralisi <lorenzo.pieralisi@arm.com>,
Andrew Murray <andrew.murray@arm.com>,
Bjorn Helgaas <bhelgaas@google.com>
Subject: Re: [PATCH v2 3/3] PCI: hv: Introduce hv_msi_entry
Date: Mon, 3 Feb 2020 09:51:40 +0000 [thread overview]
Message-ID: <20200203095140.GE20189@big-machine> (raw)
In-Reply-To: <20200203050313.69247-4-boqun.feng@gmail.com>
On Mon, Feb 03, 2020 at 01:03:13PM +0800, Boqun Feng wrote:
> Add a new structure (hv_msi_entry), which is also defined int tlfs, to
s/int/in the/ ?
> describe the msi entry for HVCALL_RETARGET_INTERRUPT. The structure is
> needed because its layout may be different from architecture to
> architecture.
>
> Also add a new generic interface hv_set_msi_address_from_desc() to allow
> different archs to set the msi address from msi_desc.
>
> No functional change, only preparation for the future support of virtual
> PCI on non-x86 architectures.
>
> Signed-off-by: Boqun Feng (Microsoft) <boqun.feng@gmail.com>
> ---
> arch/x86/include/asm/hyperv-tlfs.h | 11 +++++++++--
> arch/x86/include/asm/mshyperv.h | 5 +++++
> drivers/pci/controller/pci-hyperv.c | 4 ++--
> 3 files changed, 16 insertions(+), 4 deletions(-)
>
> diff --git a/arch/x86/include/asm/hyperv-tlfs.h b/arch/x86/include/asm/hyperv-tlfs.h
> index 4a76e442481a..953b3ad38746 100644
> --- a/arch/x86/include/asm/hyperv-tlfs.h
> +++ b/arch/x86/include/asm/hyperv-tlfs.h
> @@ -912,11 +912,18 @@ struct hv_partition_assist_pg {
> u32 tlb_lock_count;
> };
>
> +union hv_msi_entry {
> + u64 as_uint64;
> + struct {
> + u32 address;
> + u32 data;
> + } __packed;
> +};
> +
> struct hv_interrupt_entry {
> u32 source; /* 1 for MSI(-X) */
> u32 reserved1;
> - u32 address;
> - u32 data;
> + union hv_msi_entry msi_entry;
> } __packed;
>
> /*
> diff --git a/arch/x86/include/asm/mshyperv.h b/arch/x86/include/asm/mshyperv.h
> index 6b79515abb82..3bdaa3b6e68f 100644
> --- a/arch/x86/include/asm/mshyperv.h
> +++ b/arch/x86/include/asm/mshyperv.h
> @@ -240,6 +240,11 @@ bool hv_vcpu_is_preempted(int vcpu);
> static inline void hv_apic_init(void) {}
> #endif
>
> +#define hv_set_msi_address_from_desc(msi_entry, msi_desc) \
> +do { \
> + (msi_entry)->address = (msi_desc)->msg.address_lo; \
> +} while (0)
Given that this is a single statement, is there really a need for the do ; while(0) ?
> +
> #else /* CONFIG_HYPERV */
> static inline void hyperv_init(void) {}
> static inline void hyperv_setup_mmu_ops(void) {}
> diff --git a/drivers/pci/controller/pci-hyperv.c b/drivers/pci/controller/pci-hyperv.c
> index 0d9b74503577..2240f2b3643e 100644
> --- a/drivers/pci/controller/pci-hyperv.c
> +++ b/drivers/pci/controller/pci-hyperv.c
> @@ -1170,8 +1170,8 @@ static void hv_irq_unmask(struct irq_data *data)
> memset(params, 0, sizeof(*params));
> params->partition_id = HV_PARTITION_ID_SELF;
> params->int_entry.source = 1; /* MSI(-X) */
> - params->int_entry.address = msi_desc->msg.address_lo;
> - params->int_entry.data = msi_desc->msg.data;
> + hv_set_msi_address_from_desc(¶ms->int_entry.msi_entry, msi_desc);
> + params->int_entry.msi_entry.data = msi_desc->msg.data;
If the layout may differ, then don't we also need a wrapper for data?
Thanks,
Andrew Murray
> params->device_id = (hbus->hdev->dev_instance.b[5] << 24) |
> (hbus->hdev->dev_instance.b[4] << 16) |
> (hbus->hdev->dev_instance.b[7] << 8) |
> --
> 2.24.1
>
WARNING: multiple messages have this Message-ID (diff)
From: Andrew Murray <amurray@thegoodpenguin.co.uk>
To: Boqun Feng <boqun.feng@gmail.com>
Cc: Sasha Levin <sashal@kernel.org>,
linux-hyperv@vger.kernel.org,
Lorenzo Pieralisi <lorenzo.pieralisi@arm.com>,
Stephen Hemminger <sthemmin@microsoft.com>,
linux-pci@vger.kernel.org, Haiyang Zhang <haiyangz@microsoft.com>,
x86@kernel.org, linux-kernel@vger.kernel.org,
Michael Kelley <mikelley@microsoft.com>,
Ingo Molnar <mingo@redhat.com>, Borislav Petkov <bp@alien8.de>,
"H. Peter Anvin" <hpa@zytor.com>,
Bjorn Helgaas <bhelgaas@google.com>,
Andrew Murray <andrew.murray@arm.com>,
Thomas Gleixner <tglx@linutronix.de>,
"K. Y. Srinivasan" <kys@microsoft.com>,
linux-arm-kernel@lists.infradead.org
Subject: Re: [PATCH v2 3/3] PCI: hv: Introduce hv_msi_entry
Date: Mon, 3 Feb 2020 09:51:40 +0000 [thread overview]
Message-ID: <20200203095140.GE20189@big-machine> (raw)
In-Reply-To: <20200203050313.69247-4-boqun.feng@gmail.com>
On Mon, Feb 03, 2020 at 01:03:13PM +0800, Boqun Feng wrote:
> Add a new structure (hv_msi_entry), which is also defined int tlfs, to
s/int/in the/ ?
> describe the msi entry for HVCALL_RETARGET_INTERRUPT. The structure is
> needed because its layout may be different from architecture to
> architecture.
>
> Also add a new generic interface hv_set_msi_address_from_desc() to allow
> different archs to set the msi address from msi_desc.
>
> No functional change, only preparation for the future support of virtual
> PCI on non-x86 architectures.
>
> Signed-off-by: Boqun Feng (Microsoft) <boqun.feng@gmail.com>
> ---
> arch/x86/include/asm/hyperv-tlfs.h | 11 +++++++++--
> arch/x86/include/asm/mshyperv.h | 5 +++++
> drivers/pci/controller/pci-hyperv.c | 4 ++--
> 3 files changed, 16 insertions(+), 4 deletions(-)
>
> diff --git a/arch/x86/include/asm/hyperv-tlfs.h b/arch/x86/include/asm/hyperv-tlfs.h
> index 4a76e442481a..953b3ad38746 100644
> --- a/arch/x86/include/asm/hyperv-tlfs.h
> +++ b/arch/x86/include/asm/hyperv-tlfs.h
> @@ -912,11 +912,18 @@ struct hv_partition_assist_pg {
> u32 tlb_lock_count;
> };
>
> +union hv_msi_entry {
> + u64 as_uint64;
> + struct {
> + u32 address;
> + u32 data;
> + } __packed;
> +};
> +
> struct hv_interrupt_entry {
> u32 source; /* 1 for MSI(-X) */
> u32 reserved1;
> - u32 address;
> - u32 data;
> + union hv_msi_entry msi_entry;
> } __packed;
>
> /*
> diff --git a/arch/x86/include/asm/mshyperv.h b/arch/x86/include/asm/mshyperv.h
> index 6b79515abb82..3bdaa3b6e68f 100644
> --- a/arch/x86/include/asm/mshyperv.h
> +++ b/arch/x86/include/asm/mshyperv.h
> @@ -240,6 +240,11 @@ bool hv_vcpu_is_preempted(int vcpu);
> static inline void hv_apic_init(void) {}
> #endif
>
> +#define hv_set_msi_address_from_desc(msi_entry, msi_desc) \
> +do { \
> + (msi_entry)->address = (msi_desc)->msg.address_lo; \
> +} while (0)
Given that this is a single statement, is there really a need for the do ; while(0) ?
> +
> #else /* CONFIG_HYPERV */
> static inline void hyperv_init(void) {}
> static inline void hyperv_setup_mmu_ops(void) {}
> diff --git a/drivers/pci/controller/pci-hyperv.c b/drivers/pci/controller/pci-hyperv.c
> index 0d9b74503577..2240f2b3643e 100644
> --- a/drivers/pci/controller/pci-hyperv.c
> +++ b/drivers/pci/controller/pci-hyperv.c
> @@ -1170,8 +1170,8 @@ static void hv_irq_unmask(struct irq_data *data)
> memset(params, 0, sizeof(*params));
> params->partition_id = HV_PARTITION_ID_SELF;
> params->int_entry.source = 1; /* MSI(-X) */
> - params->int_entry.address = msi_desc->msg.address_lo;
> - params->int_entry.data = msi_desc->msg.data;
> + hv_set_msi_address_from_desc(¶ms->int_entry.msi_entry, msi_desc);
> + params->int_entry.msi_entry.data = msi_desc->msg.data;
If the layout may differ, then don't we also need a wrapper for data?
Thanks,
Andrew Murray
> params->device_id = (hbus->hdev->dev_instance.b[5] << 24) |
> (hbus->hdev->dev_instance.b[4] << 16) |
> (hbus->hdev->dev_instance.b[7] << 8) |
> --
> 2.24.1
>
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
next prev parent reply other threads:[~2020-02-03 9:51 UTC|newest]
Thread overview: 26+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-02-03 5:03 [PATCH v2 0/3] PCI: hv: Generify pci-hyperv.c Boqun Feng
2020-02-03 5:03 ` Boqun Feng
2020-02-03 5:03 ` [PATCH v2 1/3] PCI: hv: Move hypercall related definitions into tlfs header Boqun Feng
2020-02-03 5:03 ` Boqun Feng
2020-02-03 9:25 ` Andrew Murray
2020-02-03 9:25 ` Andrew Murray
2020-02-04 2:22 ` Boqun Feng
2020-02-04 2:22 ` Boqun Feng
2020-02-03 5:03 ` [PATCH v2 2/3] PCI: hv: Move retarget related structures " Boqun Feng
2020-02-03 5:03 ` Boqun Feng
2020-02-03 9:41 ` Andrew Murray
2020-02-03 9:41 ` Andrew Murray
2020-02-03 14:09 ` Boqun Feng
2020-02-03 14:09 ` Boqun Feng
2020-02-07 7:58 ` Boqun Feng
2020-02-07 7:58 ` Boqun Feng
2020-02-03 5:03 ` [PATCH v2 3/3] PCI: hv: Introduce hv_msi_entry Boqun Feng
2020-02-03 5:03 ` Boqun Feng
2020-02-03 9:51 ` Andrew Murray [this message]
2020-02-03 9:51 ` Andrew Murray
2020-02-03 14:35 ` Boqun Feng
2020-02-03 14:35 ` Boqun Feng
2020-02-03 14:41 ` Thomas Gleixner
2020-02-03 14:41 ` Thomas Gleixner
2020-02-04 2:13 ` Boqun Feng
2020-02-04 2:13 ` Boqun Feng
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=20200203095140.GE20189@big-machine \
--to=amurray@thegoodpenguin.co.uk \
--cc=andrew.murray@arm.com \
--cc=bhelgaas@google.com \
--cc=boqun.feng@gmail.com \
--cc=bp@alien8.de \
--cc=haiyangz@microsoft.com \
--cc=hpa@zytor.com \
--cc=kys@microsoft.com \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-hyperv@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pci@vger.kernel.org \
--cc=lorenzo.pieralisi@arm.com \
--cc=mikelley@microsoft.com \
--cc=mingo@redhat.com \
--cc=sashal@kernel.org \
--cc=sthemmin@microsoft.com \
--cc=tglx@linutronix.de \
--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 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.