Skip to content

Commit

Permalink
x86/msi.c: use plain bool
Browse files Browse the repository at this point in the history
Signed-off-by: Wei Liu <[email protected]>
Reviewed-by: Andrew Cooper <[email protected]>
  • Loading branch information
Wei Liu committed Jul 4, 2017
1 parent ebf5104 commit 27b2ed1
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 19 deletions.
32 changes: 16 additions & 16 deletions xen/arch/x86/msi.c
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ static void msix_put_fixmap(struct arch_msix *msix, int idx)
spin_unlock(&msix->table_lock);
}

static bool_t memory_decoded(const struct pci_dev *dev)
static bool memory_decoded(const struct pci_dev *dev)
{
u8 bus, slot, func;

Expand All @@ -142,13 +142,13 @@ static bool_t memory_decoded(const struct pci_dev *dev)
PCI_COMMAND_MEMORY);
}

static bool_t msix_memory_decoded(const struct pci_dev *dev, unsigned int pos)
static bool msix_memory_decoded(const struct pci_dev *dev, unsigned int pos)
{
u16 control = pci_conf_read16(dev->seg, dev->bus, PCI_SLOT(dev->devfn),
PCI_FUNC(dev->devfn), msix_control_reg(pos));

if ( !(control & PCI_MSIX_FLAGS_ENABLE) )
return 0;
return false;

return memory_decoded(dev);
}
Expand Down Expand Up @@ -191,7 +191,7 @@ void msi_compose_msg(unsigned vector, const cpumask_t *cpu_mask, struct msi_msg
MSI_DATA_VECTOR(vector);
}

static bool_t read_msi_msg(struct msi_desc *entry, struct msi_msg *msg)
static bool read_msi_msg(struct msi_desc *entry, struct msi_msg *msg)
{
switch ( entry->msi_attrib.type )
{
Expand Down Expand Up @@ -228,7 +228,7 @@ static bool_t read_msi_msg(struct msi_desc *entry, struct msi_msg *msg)

if ( unlikely(!msix_memory_decoded(entry->dev,
entry->msi_attrib.pos)) )
return 0;
return false;
msg->address_lo = readl(base + PCI_MSIX_ENTRY_LOWER_ADDR_OFFSET);
msg->address_hi = readl(base + PCI_MSIX_ENTRY_UPPER_ADDR_OFFSET);
msg->data = readl(base + PCI_MSIX_ENTRY_DATA_OFFSET);
Expand All @@ -241,7 +241,7 @@ static bool_t read_msi_msg(struct msi_desc *entry, struct msi_msg *msg)
if ( iommu_intremap )
iommu_read_msi_from_ire(entry, msg);

return 1;
return true;
}

static int write_msi_msg(struct msi_desc *entry, struct msi_msg *msg)
Expand Down Expand Up @@ -383,13 +383,13 @@ int msi_maskable_irq(const struct msi_desc *entry)
|| entry->msi_attrib.maskbit;
}

static bool_t msi_set_mask_bit(struct irq_desc *desc, bool_t host, bool_t guest)
static bool msi_set_mask_bit(struct irq_desc *desc, bool host, bool guest)
{
struct msi_desc *entry = desc->msi_desc;
struct pci_dev *pdev;
u16 seg, control;
u8 bus, slot, func;
bool_t flag = host || guest, maskall;
bool flag = host || guest, maskall;

ASSERT(spin_is_locked(&desc->lock));
BUG_ON(!entry || !entry->dev);
Expand Down Expand Up @@ -434,13 +434,13 @@ static bool_t msi_set_mask_bit(struct irq_desc *desc, bool_t host, bool_t guest)
entry->msi_attrib.host_masked = host;
entry->msi_attrib.guest_masked = guest;

flag = 1;
flag = true;
}
else if ( flag && !(control & PCI_MSIX_FLAGS_MASKALL) )
{
domid_t domid = pdev->domain->domain_id;

maskall = 1;
maskall = true;
if ( pdev->msix->warned != domid )
{
pdev->msix->warned = domid;
Expand Down Expand Up @@ -503,7 +503,7 @@ void unmask_msi_irq(struct irq_desc *desc)
WARN();
}

void guest_mask_msi_irq(struct irq_desc *desc, bool_t mask)
void guest_mask_msi_irq(struct irq_desc *desc, bool mask)
{
msi_set_mask_bit(desc, desc->msi_desc->msi_attrib.host_masked, mask);
}
Expand Down Expand Up @@ -850,7 +850,7 @@ static int msix_capability_init(struct pci_dev *dev,
u8 bus = dev->bus;
u8 slot = PCI_SLOT(dev->devfn);
u8 func = PCI_FUNC(dev->devfn);
bool_t maskall = msix->host_maskall;
bool maskall = msix->host_maskall;

ASSERT(pcidevs_locked());

Expand Down Expand Up @@ -984,7 +984,7 @@ static int msix_capability_init(struct pci_dev *dev,

if ( !msix->used_entries )
{
maskall = 0;
maskall = false;
if ( !msix->guest_maskall )
control &= ~PCI_MSIX_FLAGS_MASKALL;
else
Expand Down Expand Up @@ -1161,7 +1161,7 @@ static void __pci_disable_msix(struct msi_desc *entry)
PCI_CAP_ID_MSIX);
u16 control = pci_conf_read16(seg, bus, slot, func,
msix_control_reg(entry->msi_attrib.pos));
bool_t maskall = dev->msix->host_maskall;
bool maskall = dev->msix->host_maskall;

if ( unlikely(!(control & PCI_MSIX_FLAGS_ENABLE)) )
{
Expand All @@ -1181,7 +1181,7 @@ static void __pci_disable_msix(struct msi_desc *entry)
"cannot disable IRQ %d: masking MSI-X on %04x:%02x:%02x.%u\n",
entry->irq, dev->seg, dev->bus,
PCI_SLOT(dev->devfn), PCI_FUNC(dev->devfn));
maskall = 1;
maskall = true;
}
dev->msix->host_maskall = maskall;
if ( maskall || dev->msix->guest_maskall )
Expand All @@ -1191,7 +1191,7 @@ static void __pci_disable_msix(struct msi_desc *entry)
_pci_cleanup_msix(dev->msix);
}

int pci_prepare_msix(u16 seg, u8 bus, u8 devfn, bool_t off)
int pci_prepare_msix(u16 seg, u8 bus, u8 devfn, bool off)
{
int rc;
struct pci_dev *pdev;
Expand Down
6 changes: 3 additions & 3 deletions xen/include/asm-x86/msi.h
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ struct msi_desc;
/* Helper functions */
extern int pci_enable_msi(struct msi_info *msi, struct msi_desc **desc);
extern void pci_disable_msi(struct msi_desc *desc);
extern int pci_prepare_msix(u16 seg, u8 bus, u8 devfn, bool_t off);
extern int pci_prepare_msix(u16 seg, u8 bus, u8 devfn, bool off);
extern void pci_cleanup_msi(struct pci_dev *pdev);
extern int setup_msi_irq(struct irq_desc *, struct msi_desc *);
extern int __setup_msi_irq(struct irq_desc *, struct msi_desc *,
Expand Down Expand Up @@ -235,7 +235,7 @@ struct arch_msix {
int table_refcnt[MAX_MSIX_TABLE_PAGES];
int table_idx[MAX_MSIX_TABLE_PAGES];
spinlock_t table_lock;
bool_t host_maskall, guest_maskall;
bool host_maskall, guest_maskall;
domid_t warned;
};

Expand All @@ -245,7 +245,7 @@ void msi_compose_msg(unsigned vector, const cpumask_t *mask,
void __msi_set_enable(u16 seg, u8 bus, u8 slot, u8 func, int pos, int enable);
void mask_msi_irq(struct irq_desc *);
void unmask_msi_irq(struct irq_desc *);
void guest_mask_msi_irq(struct irq_desc *, bool_t mask);
void guest_mask_msi_irq(struct irq_desc *, bool mask);
void ack_nonmaskable_msi_irq(struct irq_desc *);
void end_nonmaskable_msi_irq(struct irq_desc *, u8 vector);
void set_msi_affinity(struct irq_desc *, const cpumask_t *);
Expand Down

0 comments on commit 27b2ed1

Please sign in to comment.