linux-pci.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v3 12/17] asm-generic/hyperv: update hv_interrupt_entry
       [not found] <20201124170744.112180-1-wei.liu@kernel.org>
@ 2020-11-24 17:07 ` Wei Liu
  2020-11-24 18:05   ` David Woodhouse
  0 siblings, 1 reply; 3+ messages in thread
From: Wei Liu @ 2020-11-24 17:07 UTC (permalink / raw)
  To: Linux on Hyper-V List
  Cc: virtualization, Linux Kernel List, Michael Kelley,
	Vineeth Pillai, Sunil Muthuswamy, Nuno Das Neves, Wei Liu,
	Rob Herring, K. Y. Srinivasan, Haiyang Zhang, Stephen Hemminger,
	Lorenzo Pieralisi, Bjorn Helgaas, Arnd Bergmann,
	open list:PCI NATIVE HOST BRIDGE AND ENDPOINT DRIVERS,
	open list:GENERIC INCLUDE/ASM HEADER FILES

We will soon use the same structure to handle IO-APIC interrupts as
well. Introduce an enum to identify the source and a data structure for
IO-APIC RTE.

While at it, update pci-hyperv.c to use the enum.

No functional change.

Signed-off-by: Wei Liu <wei.liu@kernel.org>
Acked-by: Rob Herring <robh@kernel.org>
---
 drivers/pci/controller/pci-hyperv.c |  2 +-
 include/asm-generic/hyperv-tlfs.h   | 36 +++++++++++++++++++++++++++--
 2 files changed, 35 insertions(+), 3 deletions(-)

diff --git a/drivers/pci/controller/pci-hyperv.c b/drivers/pci/controller/pci-hyperv.c
index 03ed5cb1c4b2..59edc0bf00fe 100644
--- a/drivers/pci/controller/pci-hyperv.c
+++ b/drivers/pci/controller/pci-hyperv.c
@@ -1216,7 +1216,7 @@ static void hv_irq_unmask(struct irq_data *data)
 	params = &hbus->retarget_msi_interrupt_params;
 	memset(params, 0, sizeof(*params));
 	params->partition_id = HV_PARTITION_ID_SELF;
-	params->int_entry.source = 1; /* MSI(-X) */
+	params->int_entry.source = HV_INTERRUPT_SOURCE_MSI;
 	hv_set_msi_entry_from_desc(&params->int_entry.msi_entry, msi_desc);
 	params->device_id = (hbus->hdev->dev_instance.b[5] << 24) |
 			   (hbus->hdev->dev_instance.b[4] << 16) |
diff --git a/include/asm-generic/hyperv-tlfs.h b/include/asm-generic/hyperv-tlfs.h
index 7e103be42799..8423bf53c237 100644
--- a/include/asm-generic/hyperv-tlfs.h
+++ b/include/asm-generic/hyperv-tlfs.h
@@ -480,6 +480,11 @@ struct hv_create_vp {
 	u64 flags;
 } __packed;
 
+enum hv_interrupt_source {
+	HV_INTERRUPT_SOURCE_MSI = 1, /* MSI and MSI-X */
+	HV_INTERRUPT_SOURCE_IOAPIC,
+};
+
 union hv_msi_address_register {
 	u32 as_uint32;
 	struct {
@@ -513,10 +518,37 @@ union hv_msi_entry {
 	} __packed;
 };
 
+union hv_ioapic_rte {
+	u64 as_uint64;
+
+	struct {
+		u32 vector:8;
+		u32 delivery_mode:3;
+		u32 destination_mode:1;
+		u32 delivery_status:1;
+		u32 interrupt_polarity:1;
+		u32 remote_irr:1;
+		u32 trigger_mode:1;
+		u32 interrupt_mask:1;
+		u32 reserved1:15;
+
+		u32 reserved2:24;
+		u32 destination_id:8;
+	};
+
+	struct {
+		u32 low_uint32;
+		u32 high_uint32;
+	};
+} __packed;
+
 struct hv_interrupt_entry {
-	u32 source;			/* 1 for MSI(-X) */
+	u32 source;
 	u32 reserved1;
-	union hv_msi_entry msi_entry;
+	union {
+		union hv_msi_entry msi_entry;
+		union hv_ioapic_rte ioapic_rte;
+	};
 } __packed;
 
 /*
-- 
2.20.1


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH v3 12/17] asm-generic/hyperv: update hv_interrupt_entry
  2020-11-24 17:07 ` [PATCH v3 12/17] asm-generic/hyperv: update hv_interrupt_entry Wei Liu
@ 2020-11-24 18:05   ` David Woodhouse
  2020-12-02 13:39     ` Wei Liu
  0 siblings, 1 reply; 3+ messages in thread
From: David Woodhouse @ 2020-11-24 18:05 UTC (permalink / raw)
  To: Wei Liu, Linux on Hyper-V List
  Cc: virtualization, Linux Kernel List, Michael Kelley,
	Vineeth Pillai, Sunil Muthuswamy, Nuno Das Neves, Rob Herring,
	K. Y. Srinivasan, Haiyang Zhang, Stephen Hemminger,
	Lorenzo Pieralisi, Bjorn Helgaas, Arnd Bergmann,
	open list:PCI NATIVE HOST BRIDGE AND ENDPOINT DRIVERS,
	open list:GENERIC INCLUDE/ASM HEADER FILES

[-- Attachment #1: Type: text/plain, Size: 626 bytes --]

On Tue, 2020-11-24 at 17:07 +0000, Wei Liu wrote:
> We will soon use the same structure to handle IO-APIC interrupts as
> well. Introduce an enum to identify the source and a data structure for
> IO-APIC RTE.
> 
> While at it, update pci-hyperv.c to use the enum.
> 
> No functional change.
> 
> Signed-off-by: Wei Liu <wei.liu@kernel.org>
> Acked-by: Rob Herring <robh@kernel.org>

The I/OAPIC is just a device for generating MSIs.

Can you check if this renders your patch obsolete:

https://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git/commit/?h=x86/apic&id=5d5a97133887b2dfd8e2ad0347c3a02cc7aaa0cb

[-- Attachment #2: smime.p7s --]
[-- Type: application/x-pkcs7-signature, Size: 5174 bytes --]

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH v3 12/17] asm-generic/hyperv: update hv_interrupt_entry
  2020-11-24 18:05   ` David Woodhouse
@ 2020-12-02 13:39     ` Wei Liu
  0 siblings, 0 replies; 3+ messages in thread
From: Wei Liu @ 2020-12-02 13:39 UTC (permalink / raw)
  To: David Woodhouse
  Cc: Wei Liu, Linux on Hyper-V List, virtualization,
	Linux Kernel List, Michael Kelley, Vineeth Pillai,
	Sunil Muthuswamy, Nuno Das Neves, Rob Herring, K. Y. Srinivasan,
	Haiyang Zhang, Stephen Hemminger, Lorenzo Pieralisi,
	Bjorn Helgaas, Arnd Bergmann,
	open list:PCI NATIVE HOST BRIDGE AND ENDPOINT DRIVERS,
	open list:GENERIC INCLUDE/ASM HEADER FILES

On Tue, Nov 24, 2020 at 06:05:27PM +0000, David Woodhouse wrote:
> On Tue, 2020-11-24 at 17:07 +0000, Wei Liu wrote:
> > We will soon use the same structure to handle IO-APIC interrupts as
> > well. Introduce an enum to identify the source and a data structure for
> > IO-APIC RTE.
> > 
> > While at it, update pci-hyperv.c to use the enum.
> > 
> > No functional change.
> > 
> > Signed-off-by: Wei Liu <wei.liu@kernel.org>
> > Acked-by: Rob Herring <robh@kernel.org>
> 
> The I/OAPIC is just a device for generating MSIs.
> 
> Can you check if this renders your patch obsolete:
> 
> https://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git/commit/?h=x86/apic&id=5d5a97133887b2dfd8e2ad0347c3a02cc7aaa0cb

David, thanks for your comment.

This patch merely copies the definitions from Microsoft Hypervisor. The
data structure is the exact one that is returned from the hypervisor.
The hypervisor doesn't return a pair of (addr,data). It translates
(addr,data) to IO-APIC RTE for the caller -- like what
ioapic_setup_msg_from_msi does in your patch.

I don't think your patch makes this patch obsolete.

Wei.

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2020-12-02 13:40 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <20201124170744.112180-1-wei.liu@kernel.org>
2020-11-24 17:07 ` [PATCH v3 12/17] asm-generic/hyperv: update hv_interrupt_entry Wei Liu
2020-11-24 18:05   ` David Woodhouse
2020-12-02 13:39     ` Wei Liu

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).