[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[PATCH] xen/arm: Do not route NS phys timer IRQ to Xen


  • To: <xen-devel@xxxxxxxxxxxxxxxxxxxx>
  • From: Michal Orzel <michal.orzel@xxxxxxx>
  • Date: Fri, 28 Oct 2022 09:56:30 +0200
  • Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=lists.xenproject.org smtp.mailfrom=amd.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=amd.com; dkim=none (message not signed); arc=none
  • Arc-message-signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=wutamKw3Z7Q+Eb/ceHGMavXxD6AMVnBkePAKZWrFltM=; b=SMFAnIR9Wx1nukn99obgPTUquMwePHjEkTBoTxBq+BdxqRkB+cvpv+wL0Mq/hHOTe+qqzbTY4B03rbPY/M+TtcpeQcWkaJvMk3aoVrWl0pxN/PHDcgxZnernaX4Nnf2/q/bCxBZD5QfDd6X6GcRG/jIo3ypxfHRuRNJsBmaJmBdO6e80r47jegejhSqYYutkCvwYn5UtCgGW6nnqPrkB194d3GrIBxl+f3WlIygpEQYN+FZQMU7A2ZH20mQAgHp86p5kEkm+f53pBWzNxpjbNI7b6JGMpU0ZUeN9kHhM/AfVIjZDuyEiOTfAqlYQNa9/GHaO8sDOyN66ii9g0pta6A==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=c+HlRMoj1jel+9LmkrPf5qA3D/Y+VKFuGeAai+D9BfDsY9DbY8+creOFsFPGxMMv/e/KJ8zcn9A8ORYiad4RKfy/cIEyvCAdRO3tMzItoJrqOEypWmtso82mjdUvs8YxRo6pddaXDfRucQXTrQXR7HHjq6GNYB8ZC9uR/NPiAWPachxgeH43DuwBTdp2qEHgET3gbmwlxJxPz7+fnUdoDdWKLjeY7QNcTdjRhM6ozk4AWpdhzF8rkWhA/UJGJKdaEtI3t36M7EBUiWopeedFKrgy2nf4hCFRHjpH7Rpmxtqm9XR68XBPw4ROGg/SGY9DOdYVL+L9SR4Rj6D7WuAabw==
  • Cc: Michal Orzel <michal.orzel@xxxxxxx>, Stefano Stabellini <sstabellini@xxxxxxxxxx>, Julien Grall <julien@xxxxxxx>, Bertrand Marquis <bertrand.marquis@xxxxxxx>, Volodymyr Babchuk <Volodymyr_Babchuk@xxxxxxxx>
  • Delivery-date: Fri, 28 Oct 2022 07:57:10 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

At the moment, we route NS phys timer IRQ to Xen even though it does not
make use of this timer. Xen uses hypervisor timer for itself and the
physical timer is fully emulated, hence there is nothing that can trigger
such IRQ. This means that requesting/releasing IRQ ends up as a deadcode
as it has no impact on the functional behavior, whereas the code within
a handler ends up being unreachable. This is a left over from the early
days when the CNTHP IRQ was buggy on the HW model used for testing and we
had to use the CNTP instead.

Remove the calls to {request/release}_irq for this timer as well as the
code within the handler. Since timer_interrupt handler is now only used
by the CNTHP, remove the IRQ affiliation condition. Keep the calls to
zero the CNTP_CTL_EL0 register on timer init/deinit for sanity and also remove
the corresponding perf counter definition.

Signed-off-by: Michal Orzel <michal.orzel@xxxxxxx>
---
Based on the outcome of the following discussion:
https://lore.kernel.org/xen-devel/d55938a3-aaca-1d01-b34f-858dbca9830b@xxxxxxx/
---
 xen/arch/arm/include/asm/perfc_defn.h |  1 -
 xen/arch/arm/time.c                   | 16 +---------------
 2 files changed, 1 insertion(+), 16 deletions(-)

diff --git a/xen/arch/arm/include/asm/perfc_defn.h 
b/xen/arch/arm/include/asm/perfc_defn.h
index 31f071222b24..3ab0391175d7 100644
--- a/xen/arch/arm/include/asm/perfc_defn.h
+++ b/xen/arch/arm/include/asm/perfc_defn.h
@@ -70,7 +70,6 @@ PERFCOUNTER(spis,                 "#SPIs")
 PERFCOUNTER(guest_irqs,           "#GUEST-IRQS")
 
 PERFCOUNTER(hyp_timer_irqs,   "Hypervisor timer interrupts")
-PERFCOUNTER(phys_timer_irqs,  "Physical timer interrupts")
 PERFCOUNTER(virt_timer_irqs,  "Virtual timer interrupts")
 PERFCOUNTER(maintenance_irqs, "Maintenance interrupts")
 
diff --git a/xen/arch/arm/time.c b/xen/arch/arm/time.c
index dec53b5f7d53..3160fcc7b440 100644
--- a/xen/arch/arm/time.c
+++ b/xen/arch/arm/time.c
@@ -222,8 +222,7 @@ int reprogram_timer(s_time_t timeout)
 /* Handle the firing timer */
 static void timer_interrupt(int irq, void *dev_id, struct cpu_user_regs *regs)
 {
-    if ( irq == (timer_irq[TIMER_HYP_PPI]) &&
-         READ_SYSREG(CNTHP_CTL_EL2) & CNTx_CTL_PENDING )
+    if ( READ_SYSREG(CNTHP_CTL_EL2) & CNTx_CTL_PENDING )
     {
         perfc_incr(hyp_timer_irqs);
         /* Signal the generic timer code to do its work */
@@ -231,16 +230,6 @@ static void timer_interrupt(int irq, void *dev_id, struct 
cpu_user_regs *regs)
         /* Disable the timer to avoid more interrupts */
         WRITE_SYSREG(0, CNTHP_CTL_EL2);
     }
-
-    if ( irq == (timer_irq[TIMER_PHYS_NONSECURE_PPI]) &&
-         READ_SYSREG(CNTP_CTL_EL0) & CNTx_CTL_PENDING )
-    {
-        perfc_incr(phys_timer_irqs);
-        /* Signal the generic timer code to do its work */
-        raise_softirq(TIMER_SOFTIRQ);
-        /* Disable the timer to avoid more interrupts */
-        WRITE_SYSREG(0, CNTP_CTL_EL0);
-    }
 }
 
 static void vtimer_interrupt(int irq, void *dev_id, struct cpu_user_regs *regs)
@@ -306,8 +295,6 @@ void init_timer_interrupt(void)
                 "hyptimer", NULL);
     request_irq(timer_irq[TIMER_VIRT_PPI], 0, vtimer_interrupt,
                    "virtimer", NULL);
-    request_irq(timer_irq[TIMER_PHYS_NONSECURE_PPI], 0, timer_interrupt,
-                "phytimer", NULL);
 
     check_timer_irq_cfg(timer_irq[TIMER_HYP_PPI], "hypervisor");
     check_timer_irq_cfg(timer_irq[TIMER_VIRT_PPI], "virtual");
@@ -326,7 +313,6 @@ static void deinit_timer_interrupt(void)
 
     release_irq(timer_irq[TIMER_HYP_PPI], NULL);
     release_irq(timer_irq[TIMER_VIRT_PPI], NULL);
-    release_irq(timer_irq[TIMER_PHYS_NONSECURE_PPI], NULL);
 }
 
 /* Wait a set number of microseconds */
-- 
2.25.1




 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.