* [PATCH] x86/IO-APIC: consolidate / complete #define-s
@ 2019-04-02 12:55 Jan Beulich
2019-04-02 12:57 ` Andrew Cooper
2019-04-02 13:32 ` Wei Liu
0 siblings, 2 replies; 3+ messages in thread
From: Jan Beulich @ 2019-04-02 12:55 UTC (permalink / raw)
To: xen-devel; +Cc: Andrew Cooper, Wei Liu, Roger Pau Monne
Drop redundant ones from apic.h. Add delivery mode mask. Use them in
place of open coded hex numbers.
Take the opportunity and modify a helper function's parameters to be
just unsigned int. Also drop the bogus double underscore from its name,
as it and all its callers get touched anyway.
No functional change.
Signed-off-by: Jan Beulich <jbeulich@suse.com>
--- a/xen/arch/x86/io_apic.c
+++ b/xen/arch/x86/io_apic.c
@@ -410,7 +410,8 @@ void free_ioapic_entries(struct IO_APIC_
xfree(ioapic_entries);
}
-static void __modify_IO_APIC_irq (unsigned int irq, unsigned long enable, unsigned long disable)
+static void modify_IO_APIC_irq(unsigned int irq, unsigned int enable,
+ unsigned int disable)
{
struct irq_pin_list *entry = irq_2_pin + irq;
unsigned int pin, reg;
@@ -432,25 +433,25 @@ static void __modify_IO_APIC_irq (unsign
/* mask = 1 */
static void __mask_IO_APIC_irq (unsigned int irq)
{
- __modify_IO_APIC_irq(irq, 0x00010000, 0);
+ modify_IO_APIC_irq(irq, IO_APIC_REDIR_MASKED, 0);
}
/* mask = 0 */
static void __unmask_IO_APIC_irq (unsigned int irq)
{
- __modify_IO_APIC_irq(irq, 0, 0x00010000);
+ modify_IO_APIC_irq(irq, 0, IO_APIC_REDIR_MASKED);
}
/* trigger = 0 */
static void __edge_IO_APIC_irq (unsigned int irq)
{
- __modify_IO_APIC_irq(irq, 0, 0x00008000);
+ modify_IO_APIC_irq(irq, 0, IO_APIC_REDIR_LEVEL_TRIGGER);
}
/* trigger = 1 */
static void __level_IO_APIC_irq (unsigned int irq)
{
- __modify_IO_APIC_irq(irq, 0x00008000, 0);
+ modify_IO_APIC_irq(irq, IO_APIC_REDIR_LEVEL_TRIGGER, 0);
}
static void mask_IO_APIC_irq(struct irq_desc *desc)
@@ -571,7 +572,7 @@ set_ioapic_affinity_irq(struct irq_desc
io_apic_write(entry->apic, 0x10 + 1 + pin*2, dest);
data = io_apic_read(entry->apic, 0x10 + pin*2);
data &= ~IO_APIC_REDIR_VECTOR_MASK;
- data |= desc->arch.vector & 0xFF;
+ data |= MASK_INSR(desc->arch.vector, IO_APIC_REDIR_VECTOR_MASK);
io_apic_modify(entry->apic, 0x10 + pin*2, data);
if (!entry->next)
--- a/xen/include/asm-x86/apic.h
+++ b/xen/include/asm-x86/apic.h
@@ -16,10 +16,6 @@
#define SET_APIC_LOGICAL_ID(x) (((x)<<24))
-#define IO_APIC_REDIR_VECTOR_MASK 0x000FF
-#define IO_APIC_REDIR_DEST_LOGICAL 0x00800
-#define IO_APIC_REDIR_DEST_PHYSICAL 0x00000
-
/* Possible APIC states */
enum apic_mode {
APIC_MODE_INVALID, /* Not set yet */
--- a/xen/include/asm-x86/io_apic.h
+++ b/xen/include/asm-x86/io_apic.h
@@ -21,6 +21,7 @@
/* I/O Unit Redirection Table */
#define IO_APIC_REDIR_VECTOR_MASK 0x000FF
+#define IO_APIC_REDIR_DELIV_MODE_MASK 0x00700
#define IO_APIC_REDIR_DEST_LOGICAL 0x00800
#define IO_APIC_REDIR_DEST_PHYSICAL 0x00000
#define IO_APIC_REDIR_SEND_PENDING (1 << 12)
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xenproject.org
https://lists.xenproject.org/mailman/listinfo/xen-devel
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] x86/IO-APIC: consolidate / complete #define-s
2019-04-02 12:55 [PATCH] x86/IO-APIC: consolidate / complete #define-s Jan Beulich
@ 2019-04-02 12:57 ` Andrew Cooper
2019-04-02 13:32 ` Wei Liu
1 sibling, 0 replies; 3+ messages in thread
From: Andrew Cooper @ 2019-04-02 12:57 UTC (permalink / raw)
To: Jan Beulich, xen-devel; +Cc: Wei Liu, Roger Pau Monne
On 02/04/2019 13:55, Jan Beulich wrote:
> Drop redundant ones from apic.h. Add delivery mode mask. Use them in
> place of open coded hex numbers.
>
> Take the opportunity and modify a helper function's parameters to be
> just unsigned int. Also drop the bogus double underscore from its name,
> as it and all its callers get touched anyway.
>
> No functional change.
>
> Signed-off-by: Jan Beulich <jbeulich@suse.com>
Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xenproject.org
https://lists.xenproject.org/mailman/listinfo/xen-devel
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] x86/IO-APIC: consolidate / complete #define-s
2019-04-02 12:55 [PATCH] x86/IO-APIC: consolidate / complete #define-s Jan Beulich
2019-04-02 12:57 ` Andrew Cooper
@ 2019-04-02 13:32 ` Wei Liu
1 sibling, 0 replies; 3+ messages in thread
From: Wei Liu @ 2019-04-02 13:32 UTC (permalink / raw)
To: Jan Beulich; +Cc: xen-devel, Roger Pau Monne, Wei Liu, Andrew Cooper
On Tue, Apr 02, 2019 at 06:55:44AM -0600, Jan Beulich wrote:
> Drop redundant ones from apic.h. Add delivery mode mask. Use them in
> place of open coded hex numbers.
>
> Take the opportunity and modify a helper function's parameters to be
> just unsigned int. Also drop the bogus double underscore from its name,
> as it and all its callers get touched anyway.
>
> No functional change.
>
> Signed-off-by: Jan Beulich <jbeulich@suse.com>
Reviewed-by: Wei Liu <wei.liu2@citrix.com>
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xenproject.org
https://lists.xenproject.org/mailman/listinfo/xen-devel
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2019-04-02 13:32 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-04-02 12:55 [PATCH] x86/IO-APIC: consolidate / complete #define-s Jan Beulich
2019-04-02 12:57 ` Andrew Cooper
2019-04-02 13:32 ` Wei Liu
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.