Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1446907 > unrolled thread

[PATCH 3/3] x86/apic: Clean up the apic delivery mode macro definition

Started byBaoquan He <bhe@redhat.com>
First post2016-07-20 05:00 +0200
Last post2016-07-24 01:10 +0200
Articles 3 — 2 participants

Back to article view | Back to linux.kernel

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  [PATCH 3/3] x86/apic: Clean up the apic delivery mode macro definition Baoquan He <bhe@redhat.com> - 2016-07-20 05:00 +0200
    Re: [PATCH 3/3] x86/apic: Clean up the apic delivery mode macro  definition kbuild test robot <lkp@intel.com> - 2016-07-24 01:10 +0200
    Re: [PATCH 3/3] x86/apic: Clean up the apic delivery mode macro  definition kbuild test robot <lkp@intel.com> - 2016-07-24 01:10 +0200

#1446907 — [PATCH 3/3] x86/apic: Clean up the apic delivery mode macro definition

FromBaoquan He <bhe@redhat.com>
Date2016-07-20 05:00 +0200
Subject[PATCH 3/3] x86/apic: Clean up the apic delivery mode macro definition
Message-ID<rWPTP-41h-21@gated-at.bofh.it>
Arch x86 use ICR to send IPI, and the delivery mode in ICR can be set.
They are defined like APIC_DM_xxxxx in arch/x86/include/asm/apicdef.h.
LVT table also includes a delivery mode field to set the type of
interrupt to be sent to processor, they are defined like APIC_MODE_xxxx.
And ExtINT can only be set for LVT LINT0/1, ICR can't use ExtINT either.

However the current code defines APIC_DM_EXTINT and mixed the usage of
it with APIC_MODE_EXTINT. Here clean it up.

Signed-off-by: Baoquan He <bhe@redhat.com>
---
 arch/x86/include/asm/apicdef.h | 1 -
 arch/x86/kernel/apic/apic.c    | 8 +++++---
 arch/x86/kernel/apic/io_apic.c | 7 +++++--
 3 files changed, 10 insertions(+), 6 deletions(-)

diff --git a/arch/x86/include/asm/apicdef.h b/arch/x86/include/asm/apicdef.h
index c46bb99..cbca926 100644
--- a/arch/x86/include/asm/apicdef.h
+++ b/arch/x86/include/asm/apicdef.h
@@ -85,7 +85,6 @@
 #define		APIC_DM_NMI		0x00400
 #define		APIC_DM_INIT		0x00500
 #define		APIC_DM_STARTUP		0x00600
-#define		APIC_DM_EXTINT		0x00700
 #define		APIC_VECTOR_MASK	0x000FF
 #define	APIC_ICR2	0x310
 #define		GET_APIC_DEST_FIELD(x)	(((x) >> 24) & 0xFF)
diff --git a/arch/x86/kernel/apic/apic.c b/arch/x86/kernel/apic/apic.c
index 9bb2770..7bf639d 100644
--- a/arch/x86/kernel/apic/apic.c
+++ b/arch/x86/kernel/apic/apic.c
@@ -1163,7 +1163,8 @@ void __init init_bsp_APIC(void)
 	/*
 	 * Set up the virtual wire mode.
 	 */
-	apic_write(APIC_LVT0, APIC_DM_EXTINT);
+	value = SET_APIC_DELIVERY_MODE(0, APIC_MODE_EXTINT);
+	apic_write(APIC_LVT0, value);
 	value = APIC_DM_NMI;
 	if (!lapic_is_integrated())		/* 82489DX */
 		value |= APIC_LVT_LEVEL_TRIGGER;
@@ -1377,10 +1378,11 @@ void setup_local_APIC(void)
 	 */
 	value = apic_read(APIC_LVT0) & APIC_LVT_MASKED;
 	if (!cpu && (pic_mode || !value)) {
-		value = APIC_DM_EXTINT;
+		value = SET_APIC_DELIVERY_MODE(0, APIC_MODE_EXTINT);
 		apic_printk(APIC_VERBOSE, "enabled ExtINT on CPU#%d\n", cpu);
 	} else {
-		value = APIC_DM_EXTINT | APIC_LVT_MASKED;
+		value = SET_APIC_DELIVERY_MODE(0, APIC_MODE_EXTINT);
+		value = value | APIC_LVT_MASKED;
 		apic_printk(APIC_VERBOSE, "masked ExtINT on CPU#%d\n", cpu);
 	}
 	apic_write(APIC_LVT0, value);
diff --git a/arch/x86/kernel/apic/io_apic.c b/arch/x86/kernel/apic/io_apic.c
index f3f3abe..a911564 100644
--- a/arch/x86/kernel/apic/io_apic.c
+++ b/arch/x86/kernel/apic/io_apic.c
@@ -2053,6 +2053,7 @@ static inline void __init check_timer(void)
 	int apic1, pin1, apic2, pin2;
 	unsigned long flags;
 	int no_pin1 = 0;
+	unsigned int value;
 
 	local_irq_save(flags);
 
@@ -2070,7 +2071,8 @@ static inline void __init check_timer(void)
 	 * The AEOI mode will finish them in the 8259A
 	 * automatically.
 	 */
-	apic_write(APIC_LVT0, APIC_LVT_MASKED | APIC_DM_EXTINT);
+	value = SET_APIC_DELIVERY_MODE(0, APIC_MODE_EXTINT);
+	apic_write(APIC_LVT0, APIC_LVT_MASKED | value);
 	legacy_pic->init(1);
 
 	pin1  = find_isa_irq_pin(0, mp_INT);
@@ -2171,7 +2173,8 @@ static inline void __init check_timer(void)
 
 	legacy_pic->init(0);
 	legacy_pic->make_irq(0);
-	apic_write(APIC_LVT0, APIC_DM_EXTINT);
+	value = SET_APIC_DELIVERY_MODE(0, APIC_MODE_EXTINT);
+	apic_write(APIC_LVT0, value);
 
 	unlock_ExtINT_logic();
 
-- 
2.5.5

[toc] | [next] | [standalone]


#1449016 — Re: [PATCH 3/3] x86/apic: Clean up the apic delivery mode macro definition

Fromkbuild test robot <lkp@intel.com>
Date2016-07-24 01:10 +0200
SubjectRe: [PATCH 3/3] x86/apic: Clean up the apic delivery mode macro definition
Message-ID<rYedr-ia-1@gated-at.bofh.it>
In reply to#1446907

[Multipart message — attachments visible in raw view] — view raw

Hi,

[auto build test ERROR on iommu/next]
[also build test ERROR on v4.7-rc7 next-20160722]
[cannot apply to tip/x86/core]
[if your patch is applied to the wrong git tree, please drop us a note to help improve the system]

url:    https://github.com/0day-ci/linux/commits/Baoquan-He/Enable-legacy-irq-mode-before-jump-to-kexec-kdump-kernel/20160724-054857
base:   https://git.kernel.org/pub/scm/linux/kernel/git/joro/iommu.git next
config: i386-randconfig-i0-201630 (attached as .config)
compiler: gcc-4.8 (Debian 4.8.4-1) 4.8.4
reproduce:
        # save the attached .config to linux build tree
        make ARCH=i386 

All errors (new ones prefixed by >>):

   arch/x86/kvm/lapic.c: In function '__apic_accept_irq':
>> arch/x86/kvm/lapic.c:963:7: error: 'APIC_DM_EXTINT' undeclared (first use in this function)
     case APIC_DM_EXTINT:
          ^
   arch/x86/kvm/lapic.c:963:7: note: each undeclared identifier is reported only once for each function it appears in

vim +/APIC_DM_EXTINT +963 arch/x86/kvm/lapic.c

66450a21f arch/x86/kvm/lapic.c Jan Kiszka      2013-03-13  957  		smp_wmb();
66450a21f arch/x86/kvm/lapic.c Jan Kiszka      2013-03-13  958  		set_bit(KVM_APIC_SIPI, &apic->pending_events);
3842d135f arch/x86/kvm/lapic.c Avi Kivity      2010-07-27  959  		kvm_make_request(KVM_REQ_EVENT, vcpu);
d76901750 arch/x86/kvm/lapic.c Marcelo Tosatti 2008-09-08  960  		kvm_vcpu_kick(vcpu);
97222cc83 drivers/kvm/lapic.c  Eddie Dong      2007-09-12  961  		break;
97222cc83 drivers/kvm/lapic.c  Eddie Dong      2007-09-12  962  
23930f952 arch/x86/kvm/lapic.c Jan Kiszka      2008-09-26 @963  	case APIC_DM_EXTINT:
23930f952 arch/x86/kvm/lapic.c Jan Kiszka      2008-09-26  964  		/*
23930f952 arch/x86/kvm/lapic.c Jan Kiszka      2008-09-26  965  		 * Should only be called by kvm_apic_local_deliver() with LVT0,
23930f952 arch/x86/kvm/lapic.c Jan Kiszka      2008-09-26  966  		 * before NMI watchdog was enabled. Already handled by

:::::: The code at line 963 was first introduced by commit
:::::: 23930f9521c9c4d4aa96cdb9d1e1703f3782bb94 KVM: x86: Enable NMI Watchdog via in-kernel PIT source

:::::: TO: Jan Kiszka <jan.kiszka@siemens.com>
:::::: CC: Avi Kivity <avi@redhat.com>

---
0-DAY kernel test infrastructure                Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all                   Intel Corporation

[toc] | [prev] | [next] | [standalone]


#1449017 — Re: [PATCH 3/3] x86/apic: Clean up the apic delivery mode macro definition

Fromkbuild test robot <lkp@intel.com>
Date2016-07-24 01:10 +0200
SubjectRe: [PATCH 3/3] x86/apic: Clean up the apic delivery mode macro definition
Message-ID<rYeds-ia-15@gated-at.bofh.it>
In reply to#1446907
Hi,

[auto build test WARNING on iommu/next]
[also build test WARNING on v4.7-rc7 next-20160722]
[cannot apply to tip/x86/core]
[if your patch is applied to the wrong git tree, please drop us a note to help improve the system]

url:    https://github.com/0day-ci/linux/commits/Baoquan-He/Enable-legacy-irq-mode-before-jump-to-kexec-kdump-kernel/20160724-054857
base:   https://git.kernel.org/pub/scm/linux/kernel/git/joro/iommu.git next
reproduce:
        # apt-get install sparse
        make ARCH=x86_64 allmodconfig
        make C=1 CF=-D__CHECK_ENDIAN__


sparse warnings: (new ones prefixed by >>)

   include/linux/compiler.h:232:8: sparse: attribute 'no_sanitize_address': unknown attribute
   arch/x86/kvm/lapic.c:186:15: sparse: incompatible types in comparison expression (different address spaces)
   arch/x86/kvm/lapic.c:963:14: sparse: undefined identifier 'APIC_DM_EXTINT'
>> arch/x86/kvm/lapic.c:963:14: sparse: incompatible types for 'case' statement
   arch/x86/kvm/lapic.c:699:15: sparse: incompatible types in comparison expression (different address spaces)
   arch/x86/kvm/lapic.c:799:15: sparse: incompatible types in comparison expression (different address spaces)
   arch/x86/kvm/lapic.c:963:14: sparse: Expected constant expression in case statement
   arch/x86/kvm/lapic.c: In function '__apic_accept_irq':
   arch/x86/kvm/lapic.c:963:7: error: 'APIC_DM_EXTINT' undeclared (first use in this function)
     case APIC_DM_EXTINT:
          ^~~~~~~~~~~~~~
   arch/x86/kvm/lapic.c:963:7: note: each undeclared identifier is reported only once for each function it appears in

vim +/case +963 arch/x86/kvm/lapic.c

c5ec15340 drivers/kvm/lapic.c  He, Qing        2007-09-03  947  				   vcpu->vcpu_id);
c5ec15340 drivers/kvm/lapic.c  He, Qing        2007-09-03  948  		}
97222cc83 drivers/kvm/lapic.c  Eddie Dong      2007-09-12  949  		break;
97222cc83 drivers/kvm/lapic.c  Eddie Dong      2007-09-12  950  
97222cc83 drivers/kvm/lapic.c  Eddie Dong      2007-09-12  951  	case APIC_DM_STARTUP:
1b10bf31a arch/x86/kvm/lapic.c Jan Kiszka      2008-09-30  952  		apic_debug("SIPI to vcpu %d vector 0x%02x\n",
c5ec15340 drivers/kvm/lapic.c  He, Qing        2007-09-03  953  			   vcpu->vcpu_id, vector);
6da7e3f64 arch/x86/kvm/lapic.c Gleb Natapov    2009-03-05  954  		result = 1;
66450a21f arch/x86/kvm/lapic.c Jan Kiszka      2013-03-13  955  		apic->sipi_vector = vector;
66450a21f arch/x86/kvm/lapic.c Jan Kiszka      2013-03-13  956  		/* make sure sipi_vector is visible for the receiver */
66450a21f arch/x86/kvm/lapic.c Jan Kiszka      2013-03-13  957  		smp_wmb();
66450a21f arch/x86/kvm/lapic.c Jan Kiszka      2013-03-13  958  		set_bit(KVM_APIC_SIPI, &apic->pending_events);
3842d135f arch/x86/kvm/lapic.c Avi Kivity      2010-07-27  959  		kvm_make_request(KVM_REQ_EVENT, vcpu);
d76901750 arch/x86/kvm/lapic.c Marcelo Tosatti 2008-09-08  960  		kvm_vcpu_kick(vcpu);
97222cc83 drivers/kvm/lapic.c  Eddie Dong      2007-09-12  961  		break;
97222cc83 drivers/kvm/lapic.c  Eddie Dong      2007-09-12  962  
23930f952 arch/x86/kvm/lapic.c Jan Kiszka      2008-09-26 @963  	case APIC_DM_EXTINT:
23930f952 arch/x86/kvm/lapic.c Jan Kiszka      2008-09-26  964  		/*
23930f952 arch/x86/kvm/lapic.c Jan Kiszka      2008-09-26  965  		 * Should only be called by kvm_apic_local_deliver() with LVT0,
23930f952 arch/x86/kvm/lapic.c Jan Kiszka      2008-09-26  966  		 * before NMI watchdog was enabled. Already handled by
23930f952 arch/x86/kvm/lapic.c Jan Kiszka      2008-09-26  967  		 * kvm_apic_accept_pic_intr().
23930f952 arch/x86/kvm/lapic.c Jan Kiszka      2008-09-26  968  		 */
23930f952 arch/x86/kvm/lapic.c Jan Kiszka      2008-09-26  969  		break;
23930f952 arch/x86/kvm/lapic.c Jan Kiszka      2008-09-26  970  
97222cc83 drivers/kvm/lapic.c  Eddie Dong      2007-09-12  971  	default:

:::::: The code at line 963 was first introduced by commit
:::::: 23930f9521c9c4d4aa96cdb9d1e1703f3782bb94 KVM: x86: Enable NMI Watchdog via in-kernel PIT source

:::::: TO: Jan Kiszka <jan.kiszka@siemens.com>
:::::: CC: Avi Kivity <avi@redhat.com>

---
0-DAY kernel test infrastructure                Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all                   Intel Corporation

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web