trivial changes for MSI
cover trivial changes for MSI
From: Yijing Wang <[email protected]>
Yijing Wang (3):
PCI/MSI: Clean up the kobject in struct msi_desc PCI/MSI: Remove msi_desc->msi_attrib.pos PCI/MSI: Refactor msi_bus to support EP enable/disable MSI
arch/mips/pci/msi-octeon.c | 6 +++--- drivers/pci/host/pcie-designware.c | 2 +- drivers/pci/msi.c | 13 ------------- drivers/pci/pci-sysfs.c | 12 ++++++------ include/linux/msi.h | 3 --- 5 files changed, 10 insertions(+), 26 deletions(-)
PATCH 1/3 PCI/MSI: Clean up the kobject in struct msi_desc
From: Yijing Wang <[email protected]>
commit 1c51b50c299 exported MSI mode using attributes instead of kobject. So clean up the kobject in struct msi_desc.
--- drivers/pci/msi.c | 11 ----------- include/linux/msi.h | 2 -- 2 files changed, 0 insertions(+), 13 deletions(-)
drivers/pci/msi.c +0 -11
@@ -384,17 +384,6 @@ static void free_msi_irqs(struct pci_dev *dev)iounmap (entry->mask_base); } -/* -* Its possible that we get into this path -* When populate_msi_sysfs fails, which means the entries -* were not registered with sysfs. In that case don't -* unregister them. -*/ -if (entry->kobj.parent) { -kobject_del (&entry->kobj); -kobject_put (&entry->kobj); - } -list_del (&entry->list);kfree (entry); }
include/linux/msi.h +0 -2
@@ -47,8 +47,6 @@ struct msi_desc {/* Last set MSI message */ struct msi_msg msg; - -struct kobject kobj; };/*
Signature · 1 line
1.7.1
PATCH 2/3 PCI/MSI: Remove msi_desc->msi_attrib.pos
In reply to [email protected]From: Yijing Wang <[email protected]>
Use pci_dev->msi/x_cap instead of msi_desc->msi_attrib.pos, and remove pos member.
--- arch/mips/pci/msi-octeon.c | 6 +++--- drivers/pci/host/pcie-designware.c | 2 +- drivers/pci/msi.c | 2 -- include/linux/msi.h | 1 - 4 files changed, 4 insertions(+), 7 deletions(-)
arch/mips/pci/msi-octeon.c +3 -3
@@ -73,8 +73,8 @@ int arch_setup_msi_irq(struct pci_dev *dev, struct msi_desc *desc)* wants. Most devices only want 1, which will give * configured_private_bits and request_private_bits equal 0. */ -pci_read_config_word (dev, desc->msi_attrib.pos +PCI_MSI_FLAGS , - &control); +pci_read_config_word (dev, dev->msi_cap +PCI_MSI_FLAGS , + &control);/* * If the number of private bits has been configured then use
@@ -176,7 +176,7 @@ msi_irq_allocated:/* Update the number of IRQs the device has available to it */ control &= ~PCI_MSI_FLAGS_QSIZE ; control |= request_private_bits <<4 ; -pci_write_config_word (dev, desc->msi_attrib.pos +PCI_MSI_FLAGS , +pci_write_config_word (dev, dev->msi_cap +PCI_MSI_FLAGS , control);irq_set_msi_desc (irq, desc);
drivers/pci/host/pcie-designware.c +1 -1
@@ -355,7 +355,7 @@ static int dw_msi_setup_irq(struct msi_chip *chip, struct pci_dev *pdev,return -EINVAL ; } -pci_read_config_word (pdev, desc->msi_attrib.pos+PCI_MSI_FLAGS , +pci_read_config_word (pdev, pdev->msi_cap +PCI_MSI_FLAGS , &msg_ctr); msgvec = (msg_ctr&PCI_MSI_FLAGS_QSIZE ) >>4 ;if (msgvec ==0 )
drivers/pci/msi.c +0 -2
@@ -584,7 +584,6 @@ static struct msi_desc *msi_setup_entry(struct pci_dev *dev) entry->msi_attrib.entry_nr =0 ; entry->msi_attrib.maskbit = !!(control &PCI_MSI_FLAGS_MASKBIT ); entry->msi_attrib.default_irq = dev->irq;/* Save IOAPIC IRQ */ - entry->msi_attrib.pos = dev->msi_cap; entry->msi_attrib.multi_cap = (control &PCI_MSI_FLAGS_QMASK ) >>1 ;if (control &PCI_MSI_FLAGS_64BIT )
@@ -688,7 +687,6 @@ static int msix_setup_entries(struct pci_dev *dev, void __iomem *base, entry->msi_attrib.is_64 =1 ; entry->msi_attrib.entry_nr = entries[i].entry; entry->msi_attrib.default_irq = dev->irq; - entry->msi_attrib.pos = dev->msix_cap; entry->mask_base = base;list_add_tail (&entry->list, &dev->msi_list);
include/linux/msi.h +0 -1
@@ -29,7 +29,6 @@ struct msi_desc { __u8 multi_cap : 3; /* log2 num of messages supported */ __u8 maskbit : 1; /* mask-pending bit supported ? */ __u8 is_64 : 1; /* Address size: 0=32bit 1=64bit */ -__u8 pos;/* Location of the msi capability */ __u16 entry_nr;/* specific enabled entry */ unsigned default_irq;/* default pre-assigned irq */ } msi_attrib;
Signature · 1 line
1.7.1
PATCH 3/3 PCI/MSI: Refactor msi_bus to support EP enable/disable MSI
In reply to [email protected]From: Yijing Wang <[email protected]>
Msi_bus attribute is only valid for bridge device. We can enable or disable MSI capability for a bus, if we echo 1/0 > /sys/bus/pci/devices/$EP/msi_bus, the action will be ignored. Sometime we need to only enable/disable a device MSI, not all devices share the same bus.
--- drivers/pci/pci-sysfs.c | 12 ++++++------ 1 files changed, 6 insertions(+), 6 deletions(-)
drivers/pci/pci-sysfs.c +6 -6
@@ -251,11 +251,9 @@ static ssize_t msi_bus_show(struct device *dev, struct device_attribute *attr, {struct pci_dev *pdev =to_pci_dev (dev); -if (!pdev->subordinate) -return 0 ; - -return sprintf (buf,"%u\n" , - !(pdev->subordinate->bus_flags &PCI_BUS_FLAGS_NO_MSI )); +return sprintf (buf,"%u\n" , pdev->subordinate ? + !(pdev->subordinate->bus_flags &PCI_BUS_FLAGS_NO_MSI ) + : !pdev->no_msi); } static ssize_t msi_bus_store(struct device *dev, struct device_attribute *attr,
@@ -278,8 +276,10 @@ static ssize_t msi_bus_store(struct device *dev, struct device_attribute *attr,* Maybe devices without subordinate buses shouldn't have this * attribute in the first place? */ -if (!pdev->subordinate) +if (!pdev->subordinate) { + pdev->no_msi = !val;return count; + }/* Is the flag going to change, or keep the value it already had? */ if (!(pdev->subordinate->bus_flags & PCI_BUS_FLAGS_NO_MSI) ^
Signature · 1 line
1.7.1
Re: [PATCH 1/3] PCI/MSI: Clean up the kobject in struct msi_desc
In reply to [email protected]Quoted 50 lines · On Sat, Jul 26, 2014 at 09:48:34AM +0800, [email protected] wrote:
From: Yijing Wang <[email protected]>
commit
1c51b50c299exported MSI mode using attributes instead of kobject. So clean up the kobject in structmsi_desc.Cc Greg Kroah-Hartman <[email protected]>Signed-off-by Yijing Wang <[email protected]>--- drivers/pci/msi.c | 11 ----------- include/linux/msi.h | 2 -- 2 files changed, 0 insertions(+), 13 deletions(-)drivers/pci/msi.c +0
-11@@ -384,17 +384,6 @@ static void free_msi_irqs(struct pci_dev *dev)iounmap (entry->mask_base); } -/* -* Its possible that we get into this path -* When populate_msi_sysfs fails, which means the entries -* were not registered with sysfs. In that case don't -* unregister them. -*/ -if (entry->kobj.parent) { -kobject_del (&entry->kobj); -kobject_put (&entry->kobj); - } -list_del (&entry->list);kfree (entry); }include/linux/msi.h +0
-2@@ -47,8 +47,6 @@ struct msi_desc {/* Last set MSI message */ struct msi_msg msg; - -struct kobject kobj; };/* Signature · 1 line
1.7.1
Oops, missed that one, nice catch.
Quoted 1 line · On 2014/7/26 9:48, [email protected] wrote:
From: Yijing Wang <[email protected]>
Hi Bjorn, please drop this one, I have sent new version.
Thanks!
Yijing.
Quoted 16 lines
Yijing Wang (3):
PCI/MSI: Clean up the kobject in structmsi_descPCI/MSI: Removemsi_desc->msi_attrib.posPCI/MSI: Refactormsi_busto support EP enable/disable MSIarch/mips/pci/msi-octeon.c | 6 +++--- drivers/pci/host/pcie-designware.c | 2 +- drivers/pci/msi.c | 13 ------------- drivers/pci/pci-sysfs.c | 12 ++++++------ include/linux/msi.h | 3 --- 5 files changed, 10 insertions(+), 26 deletions(-).
Signature · 2 lines
Thanks! Yijing