mirror of
https://github.com/linux-msm/laptops-kernel.git
synced 2026-08-13 14:19:53 -07:00
s390/pci: use adapter interrupt vector helpers
Make use of the adapter interrupt helpers in the PCI code. This is the first step to convert the MSI interrupt code to PCI domains. The patch removes the limitation of 64 adapter interrupts per PCI function. Reviewed-by: Sebastian Ott <sebott@linux.vnet.ibm.com> Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com>
This commit is contained in:
@@ -59,8 +59,9 @@ struct msi_map {
|
||||
struct hlist_node msi_chain;
|
||||
};
|
||||
|
||||
#define ZPCI_NR_MSI_VECS 64
|
||||
#define ZPCI_MSI_MASK (ZPCI_NR_MSI_VECS - 1)
|
||||
#define ZPCI_MSI_VEC_BITS 11
|
||||
#define ZPCI_MSI_VEC_MAX (1 << ZPCI_MSI_VEC_BITS)
|
||||
#define ZPCI_MSI_VEC_MASK (ZPCI_MSI_VEC_MAX - 1)
|
||||
|
||||
enum zpci_state {
|
||||
ZPCI_FN_STATE_RESERVED,
|
||||
@@ -92,7 +93,8 @@ struct zpci_dev {
|
||||
/* IRQ stuff */
|
||||
u64 msi_addr; /* MSI address */
|
||||
struct zdev_irq_map *irq_map;
|
||||
struct msi_map *msi_map[ZPCI_NR_MSI_VECS];
|
||||
struct msi_map *msi_map;
|
||||
struct airq_iv *aibv; /* adapter interrupt bit vector */
|
||||
unsigned int aisb; /* number of the summary bit */
|
||||
|
||||
/* DMA stuff */
|
||||
|
||||
+159
-196
File diff suppressed because it is too large
Load Diff
+5
-13
@@ -62,19 +62,15 @@ int zpci_msi_set_mask_bits(struct msi_desc *msi, u32 mask, u32 flag)
|
||||
}
|
||||
|
||||
int zpci_setup_msi_irq(struct zpci_dev *zdev, struct msi_desc *msi,
|
||||
unsigned int nr, int offset)
|
||||
unsigned int nr, int offset)
|
||||
{
|
||||
struct msi_map *map;
|
||||
struct msi_msg msg;
|
||||
int rc;
|
||||
|
||||
map = kmalloc(sizeof(*map), GFP_KERNEL);
|
||||
if (map == NULL)
|
||||
return -ENOMEM;
|
||||
|
||||
map = zdev->msi_map + (nr & ZPCI_MSI_VEC_MASK);
|
||||
map->irq = nr;
|
||||
map->msi = msi;
|
||||
zdev->msi_map[nr & ZPCI_MSI_MASK] = map;
|
||||
INIT_HLIST_NODE(&map->msi_chain);
|
||||
|
||||
pr_debug("%s hashing irq: %u to bucket nr: %llu\n",
|
||||
@@ -86,8 +82,6 @@ int zpci_setup_msi_irq(struct zpci_dev *zdev, struct msi_desc *msi,
|
||||
if (rc) {
|
||||
spin_unlock(&msi_map_lock);
|
||||
hlist_del_rcu(&map->msi_chain);
|
||||
kfree(map);
|
||||
zdev->msi_map[nr & ZPCI_MSI_MASK] = NULL;
|
||||
return rc;
|
||||
}
|
||||
spin_unlock(&msi_map_lock);
|
||||
@@ -101,20 +95,18 @@ int zpci_setup_msi_irq(struct zpci_dev *zdev, struct msi_desc *msi,
|
||||
|
||||
void zpci_teardown_msi_irq(struct zpci_dev *zdev, struct msi_desc *msi)
|
||||
{
|
||||
int irq = msi->irq & ZPCI_MSI_MASK;
|
||||
int nr = msi->irq & ZPCI_MSI_VEC_MASK;
|
||||
struct msi_map *map;
|
||||
|
||||
zpci_msi_set_mask_bits(msi, 1, 1);
|
||||
msi->msg.address_lo = 0;
|
||||
msi->msg.address_hi = 0;
|
||||
msi->msg.data = 0;
|
||||
msi->irq = 0;
|
||||
zpci_msi_set_mask_bits(msi, 1, 1);
|
||||
|
||||
spin_lock(&msi_map_lock);
|
||||
map = zdev->msi_map[irq];
|
||||
map = zdev->msi_map + nr;
|
||||
hlist_del_rcu(&map->msi_chain);
|
||||
kfree(map);
|
||||
zdev->msi_map[irq] = NULL;
|
||||
spin_unlock(&msi_map_lock);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user