diff options
| author | Jean-Philippe Brucker <jean-philippe.brucker@arm.com> | 2015-10-01 08:47:14 -0400 |
|---|---|---|
| committer | Marc Zyngier <marc.zyngier@arm.com> | 2015-10-09 18:11:50 -0400 |
| commit | 7936e914f7b0827c2dcfe63fbefdc21de2d61dcb (patch) | |
| tree | 4e10afe8e66a8e005b0e87f7d98898371ced5021 /include/linux/irqchip | |
| parent | ee5f7d6462c56ba083d5d80aa0d69914068a59ae (diff) | |
irqchip/gic-v3: Refactor the arm64 specific parts
This patch moves the GICv3 system register access helpers to
arch/arm64/. Their 32bit counterparts will need to use mrc/mcr accesses
instead of mrs_s/msr_s.
[maz: fixed conflict with Cavium erratum handling]
Reviewed-by: Marc Zyngier <marc.zyngier@arm.com>
Signed-off-by: Jean-Philippe Brucker <jean-philippe.brucker@arm.com>
Signed-off-by: Marc Zyngier <marc.zyngier@arm.com>
Diffstat (limited to 'include/linux/irqchip')
| -rw-r--r-- | include/linux/irqchip/arm-gic-v3.h | 88 |
1 files changed, 9 insertions, 79 deletions
diff --git a/include/linux/irqchip/arm-gic-v3.h b/include/linux/irqchip/arm-gic-v3.h index 9001b0bbe878..b4ee60076ff8 100644 --- a/include/linux/irqchip/arm-gic-v3.h +++ b/include/linux/irqchip/arm-gic-v3.h | |||
| @@ -18,8 +18,6 @@ | |||
| 18 | #ifndef __LINUX_IRQCHIP_ARM_GIC_V3_H | 18 | #ifndef __LINUX_IRQCHIP_ARM_GIC_V3_H |
| 19 | #define __LINUX_IRQCHIP_ARM_GIC_V3_H | 19 | #define __LINUX_IRQCHIP_ARM_GIC_V3_H |
| 20 | 20 | ||
| 21 | #include <asm/sysreg.h> | ||
| 22 | |||
| 23 | /* | 21 | /* |
| 24 | * Distributor registers. We assume we're running non-secure, with ARE | 22 | * Distributor registers. We assume we're running non-secure, with ARE |
| 25 | * being set. Secure-only and non-ARE registers are not described. | 23 | * being set. Secure-only and non-ARE registers are not described. |
| @@ -293,19 +291,8 @@ | |||
| 293 | #define ICH_VMCR_PMR_SHIFT 24 | 291 | #define ICH_VMCR_PMR_SHIFT 24 |
| 294 | #define ICH_VMCR_PMR_MASK (0xffUL << ICH_VMCR_PMR_SHIFT) | 292 | #define ICH_VMCR_PMR_MASK (0xffUL << ICH_VMCR_PMR_SHIFT) |
| 295 | 293 | ||
| 296 | #define ICC_EOIR1_EL1 sys_reg(3, 0, 12, 12, 1) | ||
| 297 | #define ICC_DIR_EL1 sys_reg(3, 0, 12, 11, 1) | ||
| 298 | #define ICC_IAR1_EL1 sys_reg(3, 0, 12, 12, 0) | ||
| 299 | #define ICC_SGI1R_EL1 sys_reg(3, 0, 12, 11, 5) | ||
| 300 | #define ICC_PMR_EL1 sys_reg(3, 0, 4, 6, 0) | ||
| 301 | #define ICC_CTLR_EL1 sys_reg(3, 0, 12, 12, 4) | ||
| 302 | #define ICC_SRE_EL1 sys_reg(3, 0, 12, 12, 5) | ||
| 303 | #define ICC_GRPEN1_EL1 sys_reg(3, 0, 12, 12, 7) | ||
| 304 | |||
| 305 | #define ICC_IAR1_EL1_SPURIOUS 0x3ff | 294 | #define ICC_IAR1_EL1_SPURIOUS 0x3ff |
| 306 | 295 | ||
| 307 | #define ICC_SRE_EL2 sys_reg(3, 4, 12, 9, 5) | ||
| 308 | |||
| 309 | #define ICC_SRE_EL2_SRE (1 << 0) | 296 | #define ICC_SRE_EL2_SRE (1 << 0) |
| 310 | #define ICC_SRE_EL2_ENABLE (1 << 3) | 297 | #define ICC_SRE_EL2_ENABLE (1 << 3) |
| 311 | 298 | ||
| @@ -321,54 +308,10 @@ | |||
| 321 | #define ICC_SGI1R_AFFINITY_3_SHIFT 48 | 308 | #define ICC_SGI1R_AFFINITY_3_SHIFT 48 |
| 322 | #define ICC_SGI1R_AFFINITY_3_MASK (0xffULL << ICC_SGI1R_AFFINITY_1_SHIFT) | 309 | #define ICC_SGI1R_AFFINITY_3_MASK (0xffULL << ICC_SGI1R_AFFINITY_1_SHIFT) |
| 323 | 310 | ||
| 324 | /* | 311 | #include <asm/arch_gicv3.h> |
| 325 | * System register definitions | ||
| 326 | */ | ||
| 327 | #define ICH_VSEIR_EL2 sys_reg(3, 4, 12, 9, 4) | ||
| 328 | #define ICH_HCR_EL2 sys_reg(3, 4, 12, 11, 0) | ||
| 329 | #define ICH_VTR_EL2 sys_reg(3, 4, 12, 11, 1) | ||
| 330 | #define ICH_MISR_EL2 sys_reg(3, 4, 12, 11, 2) | ||
| 331 | #define ICH_EISR_EL2 sys_reg(3, 4, 12, 11, 3) | ||
| 332 | #define ICH_ELSR_EL2 sys_reg(3, 4, 12, 11, 5) | ||
| 333 | #define ICH_VMCR_EL2 sys_reg(3, 4, 12, 11, 7) | ||
| 334 | |||
| 335 | #define __LR0_EL2(x) sys_reg(3, 4, 12, 12, x) | ||
| 336 | #define __LR8_EL2(x) sys_reg(3, 4, 12, 13, x) | ||
| 337 | |||
| 338 | #define ICH_LR0_EL2 __LR0_EL2(0) | ||
| 339 | #define ICH_LR1_EL2 __LR0_EL2(1) | ||
| 340 | #define ICH_LR2_EL2 __LR0_EL2(2) | ||
| 341 | #define ICH_LR3_EL2 __LR0_EL2(3) | ||
| 342 | #define ICH_LR4_EL2 __LR0_EL2(4) | ||
| 343 | #define ICH_LR5_EL2 __LR0_EL2(5) | ||
| 344 | #define ICH_LR6_EL2 __LR0_EL2(6) | ||
| 345 | #define ICH_LR7_EL2 __LR0_EL2(7) | ||
| 346 | #define ICH_LR8_EL2 __LR8_EL2(0) | ||
| 347 | #define ICH_LR9_EL2 __LR8_EL2(1) | ||
| 348 | #define ICH_LR10_EL2 __LR8_EL2(2) | ||
| 349 | #define ICH_LR11_EL2 __LR8_EL2(3) | ||
| 350 | #define ICH_LR12_EL2 __LR8_EL2(4) | ||
| 351 | #define ICH_LR13_EL2 __LR8_EL2(5) | ||
| 352 | #define ICH_LR14_EL2 __LR8_EL2(6) | ||
| 353 | #define ICH_LR15_EL2 __LR8_EL2(7) | ||
| 354 | |||
| 355 | #define __AP0Rx_EL2(x) sys_reg(3, 4, 12, 8, x) | ||
| 356 | #define ICH_AP0R0_EL2 __AP0Rx_EL2(0) | ||
| 357 | #define ICH_AP0R1_EL2 __AP0Rx_EL2(1) | ||
| 358 | #define ICH_AP0R2_EL2 __AP0Rx_EL2(2) | ||
| 359 | #define ICH_AP0R3_EL2 __AP0Rx_EL2(3) | ||
| 360 | |||
| 361 | #define __AP1Rx_EL2(x) sys_reg(3, 4, 12, 9, x) | ||
| 362 | #define ICH_AP1R0_EL2 __AP1Rx_EL2(0) | ||
| 363 | #define ICH_AP1R1_EL2 __AP1Rx_EL2(1) | ||
| 364 | #define ICH_AP1R2_EL2 __AP1Rx_EL2(2) | ||
| 365 | #define ICH_AP1R3_EL2 __AP1Rx_EL2(3) | ||
| 366 | 312 | ||
| 367 | #ifndef __ASSEMBLY__ | 313 | #ifndef __ASSEMBLY__ |
| 368 | 314 | ||
| 369 | #include <linux/stringify.h> | ||
| 370 | #include <asm/msi.h> | ||
| 371 | |||
| 372 | /* | 315 | /* |
| 373 | * We need a value to serve as a irq-type for LPIs. Choose one that will | 316 | * We need a value to serve as a irq-type for LPIs. Choose one that will |
| 374 | * hopefully pique the interest of the reviewer. | 317 | * hopefully pique the interest of the reviewer. |
| @@ -386,39 +329,26 @@ struct rdists { | |||
| 386 | u64 flags; | 329 | u64 flags; |
| 387 | }; | 330 | }; |
| 388 | 331 | ||
| 389 | static inline void gic_write_eoir(u64 irq) | 332 | struct irq_domain; |
| 390 | { | 333 | int its_cpu_init(void); |
| 391 | asm volatile("msr_s " __stringify(ICC_EOIR1_EL1) ", %0" : : "r" (irq)); | 334 | int its_init(struct device_node *node, struct rdists *rdists, |
| 392 | isb(); | 335 | struct irq_domain *domain); |
| 393 | } | ||
| 394 | |||
| 395 | static inline void gic_write_dir(u64 irq) | ||
| 396 | { | ||
| 397 | asm volatile("msr_s " __stringify(ICC_DIR_EL1) ", %0" : : "r" (irq)); | ||
| 398 | isb(); | ||
| 399 | } | ||
| 400 | 336 | ||
| 401 | static inline bool gic_enable_sre(void) | 337 | static inline bool gic_enable_sre(void) |
| 402 | { | 338 | { |
| 403 | u64 val; | 339 | u32 val; |
| 404 | 340 | ||
| 405 | asm volatile("mrs_s %0, " __stringify(ICC_SRE_EL1) : "=r" (val)); | 341 | val = gic_read_sre(); |
| 406 | if (val & ICC_SRE_EL1_SRE) | 342 | if (val & ICC_SRE_EL1_SRE) |
| 407 | return true; | 343 | return true; |
| 408 | 344 | ||
| 409 | val |= ICC_SRE_EL1_SRE; | 345 | val |= ICC_SRE_EL1_SRE; |
| 410 | asm volatile("msr_s " __stringify(ICC_SRE_EL1) ", %0" : : "r" (val)); | 346 | gic_write_sre(val); |
| 411 | isb(); | 347 | val = gic_read_sre(); |
| 412 | asm volatile("mrs_s %0, " __stringify(ICC_SRE_EL1) : "=r" (val)); | ||
| 413 | 348 | ||
| 414 | return !!(val & ICC_SRE_EL1_SRE); | 349 | return !!(val & ICC_SRE_EL1_SRE); |
| 415 | } | 350 | } |
| 416 | 351 | ||
| 417 | struct irq_domain; | ||
| 418 | int its_cpu_init(void); | ||
| 419 | int its_init(struct device_node *node, struct rdists *rdists, | ||
| 420 | struct irq_domain *domain); | ||
| 421 | |||
| 422 | #endif | 352 | #endif |
| 423 | 353 | ||
| 424 | #endif | 354 | #endif |
