From patchwork Wed Dec 18 18:15:07 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Alex_Benn=C3=A9e?= X-Patchwork-Id: 13914017 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id F230DE7718A for ; Wed, 18 Dec 2024 18:17:01 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tNyb5-0001Wm-69; Wed, 18 Dec 2024 13:16:35 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1tNya2-0001B8-BB for qemu-devel@nongnu.org; Wed, 18 Dec 2024 13:15:30 -0500 Received: from mail-ed1-x531.google.com ([2a00:1450:4864:20::531]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1tNyZx-0007VW-ON for qemu-devel@nongnu.org; Wed, 18 Dec 2024 13:15:27 -0500 Received: by mail-ed1-x531.google.com with SMTP id 4fb4d7f45d1cf-5d647d5df90so8558689a12.2 for ; Wed, 18 Dec 2024 10:15:15 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1734545715; x=1735150515; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=/YHnueKZJegjzPbCxN1afH6WivB/pbe8W0/PepPUkRc=; b=rr2BFHW4/2pHdpsU8btR4ZmSVGABZ5BGF4ObCs7+9nvCsVZ36yg9oHZncUb8Nl8579 qM7W9P5yyS1mOnW0j///Ew6L1fR4ub5zORvTPmHUfIdbCGUsd1TGNIeKqeMlNJ/9S/QG 9iDa00Ai859gRLmVhguWcR3h56vLu7CDC9X4Sfw+WbQgsZAmm9aiMY/gRQncndFneK2C 7+MROGzCfsr9iZr5bbOnh54MaZbgdmdRtYsKeE9918/VzER3aWTeVP0cYlIBVP5geYCL NbIkPPvVpVH3jP5ylUiq9MCeYuoL5OSTOpltUbrS03bn9GF1UaXUCbn8uQ3oNmwAMq+L DwDw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1734545715; x=1735150515; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=/YHnueKZJegjzPbCxN1afH6WivB/pbe8W0/PepPUkRc=; b=OJdwWrXidrpoFOZs7NO3VJBU2urQ0Rus8oMrCeGiMzO4xS5/PoSOIlV75SOgXwp/eR Y/cz0uRNHkF3/QgJwQBpxHUa0CLcaWcUW0R/Yv47MGI/FRirCB3J6GACZPNDTkyTsBXL oc1sh6jAXyXcsE+PMLT1fAaPG8yHJeBBmImU5nUX5xDjnUQs9fNwiQPKHOr12V1mkqd5 cTGcXRA41XMDCQvbeRNn7hJJrKQw3DfVKAs/qVWXPpHf06XqVAP/JGz8K9KlTbVe7AxE EsdBkbsjtypatfjIiZm/b04TtiokH8GZGPVZ8knboHI2psuXFPO3EuG7ffKfrrlLrr0v nlGQ== X-Gm-Message-State: AOJu0Yyiabry7qFSAXnxielRBVQZbAD/tmR/ErKsosrmoL1H/FfvTBXX HDoanFq56F0xje8hOA6Bv/WVc5jsB5VlM3sOq7RCLg49a7OZQMvvT4GJEUsllnc= X-Gm-Gg: ASbGncvCSR/TKPwCWpOIwXRPzPjYQyeYEeIeJf0iwLjMkKxvSRiDgIz3lpJmYQZrBht TWkATa6Thbwjz+lf0vP/5w/JX1wTZzj2UIdsL/LzR8nJS9vIp4oUm3chOJ88A9u1nTasuns/m85 keVoGT36xkUCHS4hgFGDDUvGZrnddVkYxj4iEU5pLoDpv4/xBOrDXzJCHiuC9h9UWwx1S894SYn Kr0Rje3hydgoH5K+JI+9FzP4wpsG4MW6MihYYun3Zk71W30OPof6Zo= X-Google-Smtp-Source: AGHT+IHoCskYOF9lwlHh4GLBO5KCKL26eP2BiRg5NDAUzzVE0wco+2Ookj78VwJPhpJhoYW112NEpA== X-Received: by 2002:a05:6402:2790:b0:5d3:ba42:ea03 with SMTP id 4fb4d7f45d1cf-5d7ee3c857emr3887517a12.8.1734545714813; Wed, 18 Dec 2024 10:15:14 -0800 (PST) Received: from draig.lan ([85.9.250.243]) by smtp.gmail.com with ESMTPSA id 4fb4d7f45d1cf-5d652ae137bsm5608894a12.51.2024.12.18.10.15.12 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 18 Dec 2024 10:15:12 -0800 (PST) Received: from draig.lan (localhost [IPv6:::1]) by draig.lan (Postfix) with ESMTP id 8B4B55F86B; Wed, 18 Dec 2024 18:15:11 +0000 (GMT) From: =?utf-8?q?Alex_Benn=C3=A9e?= To: qemu-devel@nongnu.org Cc: Leif Lindholm , Leif Lindholm , Marcin Juszkiewicz , Peter Maydell , Radoslaw Biernacki , qemu-arm@nongnu.org, =?utf-8?q?Alex_?= =?utf-8?q?Benn=C3=A9e?= , qemu-stable@nongnu.org Subject: [PATCH v2 1/5] target/arm: document the architectural names of our GTIMERs Date: Wed, 18 Dec 2024 18:15:07 +0000 Message-Id: <20241218181511.3575613-2-alex.bennee@linaro.org> X-Mailer: git-send-email 2.39.5 In-Reply-To: <20241218181511.3575613-1-alex.bennee@linaro.org> References: <20241218181511.3575613-1-alex.bennee@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::531; envelope-from=alex.bennee@linaro.org; helo=mail-ed1-x531.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=unavailable autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org As we are about to add more physical and virtual timers lets make it clear what each timer does. Signed-off-by: Alex Bennée Reviewed-by: Peter Maydell Cc: qemu-stable@nongnu.org --- target/arm/gtimer.h | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/target/arm/gtimer.h b/target/arm/gtimer.h index b992941bef..de016e6da3 100644 --- a/target/arm/gtimer.h +++ b/target/arm/gtimer.h @@ -10,11 +10,11 @@ #define TARGET_ARM_GTIMER_H enum { - GTIMER_PHYS = 0, - GTIMER_VIRT = 1, - GTIMER_HYP = 2, - GTIMER_SEC = 3, - GTIMER_HYPVIRT = 4, + GTIMER_PHYS = 0, /* EL1 physical timer */ + GTIMER_VIRT = 1, /* EL1 virtual timer */ + GTIMER_HYP = 2, /* EL2 physical timer */ + GTIMER_SEC = 3, /* EL3 physical timer */ + GTIMER_HYPVIRT = 4, /* EL2 virtual timer */ #define NUM_GTIMERS 5 }; From patchwork Wed Dec 18 18:15:08 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Alex_Benn=C3=A9e?= X-Patchwork-Id: 13914016 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id E28B3E77187 for ; Wed, 18 Dec 2024 18:17:00 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tNyaq-0001KZ-VG; Wed, 18 Dec 2024 13:16:28 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1tNya2-0001BD-Js for qemu-devel@nongnu.org; Wed, 18 Dec 2024 13:15:30 -0500 Received: from mail-ed1-x535.google.com ([2a00:1450:4864:20::535]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1tNyZy-0007Vc-Bl for qemu-devel@nongnu.org; Wed, 18 Dec 2024 13:15:28 -0500 Received: by mail-ed1-x535.google.com with SMTP id 4fb4d7f45d1cf-5d0ac27b412so9375904a12.1 for ; Wed, 18 Dec 2024 10:15:16 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1734545715; x=1735150515; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=1kN/ZYXoIAzuNuSPL620rsLxZYj3p6quBDyJTtx4PN0=; b=qR3VP4VtC82gaa/mOQQ5md1aRaSB3uy8pb6jAUlo59qovSG/6rTcudADLLUmg2X3lm k0UvemaAg6upaw6UzB+y23qdWgn9PYqJPyrqF8o6lRnB0nEN3GmYNraat+ZoNPL2EGvW BfvrwZzXlq3yGztVPl65AF5YkRlZkPESAhq2+zsXd/7xmw7oZpuk2v4+ukI65VMbzs6o rzMpQkUjkbkwIONABlsQsfL9/4nVyuphu/JuLirHEP1ciAJbzB/ru97qAnsyITvAfxGa OU8aRUDEvUTm1XajnOWXHo7BFL8nxPiRRiyHXvlCqLl6KwGtdhH4xCO0exams0Nxkwk0 xbxw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1734545715; x=1735150515; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=1kN/ZYXoIAzuNuSPL620rsLxZYj3p6quBDyJTtx4PN0=; b=LhmqSgRslf4pNzILmlnM+gvzMtGu7fyAMeTmGjGPtXJHIHAJuK1yPSz8DmhhvffIsr jfFhK9R2Bgzt65+NyCbCfrzvDP9vk4/lx2KoktgdqPN1EFIxn0l3MTnnXXPbWWdrOMxb xzxcjyitpVrWwEt8iywY5Csj35IOQ/wjzfSzANSo2b6bJ5OmhA8qQOEwRsArn9NSaztj 9vERMTiCu4rzT/Zp6CnDA6MsxLI4QNubIM56V5gEu54nzPQX7jceqJcHgk3ChEMXiqOl Q1SwuwJFvU/Yu2pZPp3AeyHZKDpfNWClANKBAEtxvODaT1KNgqaz2q2fw8e/YW0WAsXW JHmA== X-Gm-Message-State: AOJu0YxmvR9TQF+z6M0gqIPWtjc19PxdSdhexAcpQJENHzCEsUKHpZTV 3KXcINHDyktkSdmrNFqLQrxwQNdb61rnXnjmojPvDIit/YutbloZCYnE/OqdIxk= X-Gm-Gg: ASbGncsqp2UJdA8PvUlmQmOl2ctUIbDE51ob8jxXT+RrHU9/7Dw1/w4lMIZNDMGJo6b wMpfePU18A9XHlrGMvmOD/E+XuP9ospGcOc2+iUyg9DxLE5zLsqF+aS483SAPP5KbrLW78VVeVP 9tHVuWG5WtqfCIwvELgmZk9cshnXWMCoqrD1f2DWmRhbr61upjpKGhSbif1rEzAIYxDy1BR+Lp0 6yvykqAVEXrQaPSPYcwaKCRPo7LonJx/1UT13vsHYiWBxixC8Ty4gQ= X-Google-Smtp-Source: AGHT+IHsI0Co9EhYUpBJrUuYBCdI+5ypIA6xtjjr4rxw6ykwwDq+P173riTxy0yOlEgy4uqPxlyrtQ== X-Received: by 2002:a05:6402:43c4:b0:5d0:b040:4616 with SMTP id 4fb4d7f45d1cf-5d7ee41e7fdmr3678720a12.28.1734545715136; Wed, 18 Dec 2024 10:15:15 -0800 (PST) Received: from draig.lan ([85.9.250.243]) by smtp.gmail.com with ESMTPSA id 4fb4d7f45d1cf-5d652ae10a7sm5564454a12.38.2024.12.18.10.15.12 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 18 Dec 2024 10:15:13 -0800 (PST) Received: from draig.lan (localhost [IPv6:::1]) by draig.lan (Postfix) with ESMTP id 9FF175FB2E; Wed, 18 Dec 2024 18:15:11 +0000 (GMT) From: =?utf-8?q?Alex_Benn=C3=A9e?= To: qemu-devel@nongnu.org Cc: Leif Lindholm , Leif Lindholm , Marcin Juszkiewicz , Peter Maydell , Radoslaw Biernacki , qemu-arm@nongnu.org, =?utf-8?q?Alex_?= =?utf-8?q?Benn=C3=A9e?= , qemu-stable@nongnu.org Subject: [PATCH v2 2/5] target/arm: ensure cntvoff_el2 also used for EL2 virt timer Date: Wed, 18 Dec 2024 18:15:08 +0000 Message-Id: <20241218181511.3575613-3-alex.bennee@linaro.org> X-Mailer: git-send-email 2.39.5 In-Reply-To: <20241218181511.3575613-1-alex.bennee@linaro.org> References: <20241218181511.3575613-1-alex.bennee@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::535; envelope-from=alex.bennee@linaro.org; helo=mail-ed1-x535.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org We were missing this case and will shortly be adding another. Re-arrange the code and use a switch statement to group the virtual timers. Signed-off-by: Alex Bennée Cc: qemu-stable@nongnu.org --- target/arm/helper.c | 21 ++++++++++++++++----- 1 file changed, 16 insertions(+), 5 deletions(-) diff --git a/target/arm/helper.c b/target/arm/helper.c index 910ae62c47..5a1b416e18 100644 --- a/target/arm/helper.c +++ b/target/arm/helper.c @@ -2465,16 +2465,27 @@ static void gt_recalc_timer(ARMCPU *cpu, int timeridx) ARMGenericTimer *gt = &cpu->env.cp15.c14_timer[timeridx]; if (gt->ctl & 1) { + uint64_t count = gt_get_countervalue(&cpu->env); + uint64_t offset; + uint64_t nexttick; + int istatus; + /* * Timer enabled: calculate and set current ISTATUS, irq, and * reset timer to when ISTATUS next has to change */ - uint64_t offset = timeridx == GTIMER_VIRT ? - cpu->env.cp15.cntvoff_el2 : gt_phys_raw_cnt_offset(&cpu->env); - uint64_t count = gt_get_countervalue(&cpu->env); + switch (timeridx) { + case GTIMER_VIRT: + case GTIMER_HYPVIRT: + offset = cpu->env.cp15.cntvoff_el2; + break; + default: + offset =gt_phys_raw_cnt_offset(&cpu->env); + break; + } + /* Note that this must be unsigned 64 bit arithmetic: */ - int istatus = count - offset >= gt->cval; - uint64_t nexttick; + istatus = count - offset >= gt->cval; gt->ctl = deposit32(gt->ctl, 2, 1, istatus); From patchwork Wed Dec 18 18:15:09 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Alex_Benn=C3=A9e?= X-Patchwork-Id: 13914020 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 76708E77187 for ; Wed, 18 Dec 2024 18:18:05 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tNybE-0001qS-Iu; Wed, 18 Dec 2024 13:16:44 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1tNya5-0001BX-HL for qemu-devel@nongnu.org; Wed, 18 Dec 2024 13:15:39 -0500 Received: from mail-ej1-x62f.google.com ([2a00:1450:4864:20::62f]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1tNyZy-0007Uq-C3 for qemu-devel@nongnu.org; Wed, 18 Dec 2024 13:15:30 -0500 Received: by mail-ej1-x62f.google.com with SMTP id a640c23a62f3a-aa684b6d9c7so1127595066b.2 for ; Wed, 18 Dec 2024 10:15:14 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1734545713; x=1735150513; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=AD97N8COPTYSMDXtY1MhEbU7l3cbJRTSxfiB52rlJcg=; b=ReoYQIrKxcZ4wCHiNYMd4qldnnjAOZ0jKZJKrmxD3g4VHqfNl8S9qg6KimWrs9o+87 9+Cv3sUn4dU9wZCFKwnYrm/MJh5XuRyDkSBk+B4pAhFdOGU+GRskA1R8u8jar7WYKk9N Rv2AfHQVdEqDH+vW2V3HeSL9uAeJME8HDeD+8IIEohVTAa0yHTKFwzA6F8zU4EONZtnl SU0figsf3WHF4xHdY8HMJg3pxaZOmC1mQ27DLR3pZROSXyFsACqyUaVSbpYpwHXHSIa1 3mvHloNx0MuxDZZSd/TyY/4fAMfDkV+u8fhRT3gK3/qzadhwikWZl6hQbnIZEaiAfB+e NFlA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1734545713; x=1735150513; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=AD97N8COPTYSMDXtY1MhEbU7l3cbJRTSxfiB52rlJcg=; b=mR94lxDUu0lPm0pTjatymfZVKb3ecqfEkAbLI0kWVV/iGP8JWU77QCzx2vr1uG8ixk Vl63FFwiNVrv4HuY2jANOSP3xpzBPH/tFX5X9AjtGfQ/d7oP9p6JTSKYF9ONUlzac14S OVPQ0vDM3dXgm92xbU8RJFKdQUETfGsv+YdV8Q/4yTs99jBUuDw1N8CpjTxQSAoPw8eb 0m9t5naRtA5rS8KHa/W9n0QAMgq+D0P592IFBTTKCOGGmZLJPInrqzY2gfJa8zd3cEnq FZwZwwO+pwSp5bSz5CuGwmWvdjEVEZU4KFC4jWRQhgNnrffB0E2mHZB+9lxv9KqJwBQz 4eSQ== X-Gm-Message-State: AOJu0YxmJCV93qwFdWvZ0l6kYh4Bko7NYwm1DBF9poOa4wlKR5RJbwY+ 7DfLj3WYMiO98BXNnNz8MBIku1D4gepZByiSjhQTw77fzcKQ/RP4DIotG/j7lH0= X-Gm-Gg: ASbGnctHVtcvOQimnEuP0SIMpnB5wZZdV4qW7BWneQeEr2+q9iGy+BMfzeR8XO93llJ kuS6XzkstkM42rgFFznKHC7B3rndG7oYdFljwjs1B92uZPEoyn4l4nAqXdNUwCbwpp8Q2UyWGlY tGLu/gM7rTSVVIKvDRt0rEbQX5KfosC0dJn78QFxsv5+qgFjSF6YpHDEsmxyCbMnLLGeXeg/wec q5pzamKMULglR3T0WU4ThhUwWquogBYS4avP0OrGM/YMdf9FSe92b8= X-Google-Smtp-Source: AGHT+IGlQGNgGULh+jpe7Ie3uXzVSTzbldOZTV9JqjhVGu7g1aVuwnCtXX0/2rRvxGeIZFhCt90Ufw== X-Received: by 2002:a17:906:32ce:b0:aa6:88ae:22a with SMTP id a640c23a62f3a-aabf49079fdmr290738066b.37.1734545713215; Wed, 18 Dec 2024 10:15:13 -0800 (PST) Received: from draig.lan ([85.9.250.243]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-aab963b5072sm578167666b.178.2024.12.18.10.15.12 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 18 Dec 2024 10:15:12 -0800 (PST) Received: from draig.lan (localhost [IPv6:::1]) by draig.lan (Postfix) with ESMTP id B96BD5FBC6; Wed, 18 Dec 2024 18:15:11 +0000 (GMT) From: =?utf-8?q?Alex_Benn=C3=A9e?= To: qemu-devel@nongnu.org Cc: Leif Lindholm , Leif Lindholm , Marcin Juszkiewicz , Peter Maydell , Radoslaw Biernacki , qemu-arm@nongnu.org, =?utf-8?q?Alex_?= =?utf-8?q?Benn=C3=A9e?= , qemu-stable@nongnu.org, Andrei Homescu , =?utf-8?q?Arve_Hj=C3=B8nnev=C3=A5g?= , =?utf-8?q?R=C3=A9mi?= =?utf-8?q?_Denis-Courmont?= Subject: [PATCH v2 3/5] target/arm: implement SEL2 physical and virtual timers Date: Wed, 18 Dec 2024 18:15:09 +0000 Message-Id: <20241218181511.3575613-4-alex.bennee@linaro.org> X-Mailer: git-send-email 2.39.5 In-Reply-To: <20241218181511.3575613-1-alex.bennee@linaro.org> References: <20241218181511.3575613-1-alex.bennee@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::62f; envelope-from=alex.bennee@linaro.org; helo=mail-ej1-x62f.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=unavailable autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org When FEAT_SEL2 was implemented the SEL2 timers where missed. This shows up when building the latest Hafnium with SPMC_AT_EL=2. The actual implementation utilises the same logic as the rest of the timers so all we need to do is: - define the timers and their access functions - conditionally add the correct system registers - create a new accessfn as the rules are subtly different to the existing secure timer Fixes: e9152ee91c (target/arm: add ARMv8.4-SEL2 system registers) Signed-off-by: Alex Bennée Cc: qemu-stable@nongnu.org Cc: Andrei Homescu Cc: Arve Hjønnevåg Cc: Rémi Denis-Courmont --- v1 - add better comments to GTIMER descriptions - also define new timers for sbsa-ref - don't conditionally gate qemu_timer creation on the feature - take cntvoff_el2 int account for SEC_VEL2 in gt_recalc/g_tval_[read|write] v2 - rename IRQ to ARCH_TIMER_S_EL2_VIRT_IRQ - split machine enablement into separate patches - return CP_ACCESS_TRAP_UNCATEGORIZED for UNDEF cases --- include/hw/arm/bsa.h | 2 + target/arm/cpu.h | 2 + target/arm/gtimer.h | 4 +- target/arm/cpu.c | 4 ++ target/arm/helper.c | 158 +++++++++++++++++++++++++++++++++++++++++++ 5 files changed, 169 insertions(+), 1 deletion(-) diff --git a/include/hw/arm/bsa.h b/include/hw/arm/bsa.h index 8eaab603c0..13ed2d2ac1 100644 --- a/include/hw/arm/bsa.h +++ b/include/hw/arm/bsa.h @@ -22,6 +22,8 @@ #define QEMU_ARM_BSA_H /* These are architectural INTID values */ +#define ARCH_TIMER_S_EL2_VIRT_IRQ 19 +#define ARCH_TIMER_S_EL2_IRQ 20 #define VIRTUAL_PMU_IRQ 23 #define ARCH_GIC_MAINT_IRQ 25 #define ARCH_TIMER_NS_EL2_IRQ 26 diff --git a/target/arm/cpu.h b/target/arm/cpu.h index d86e641280..10b5354d6f 100644 --- a/target/arm/cpu.h +++ b/target/arm/cpu.h @@ -1139,6 +1139,8 @@ void arm_gt_vtimer_cb(void *opaque); void arm_gt_htimer_cb(void *opaque); void arm_gt_stimer_cb(void *opaque); void arm_gt_hvtimer_cb(void *opaque); +void arm_gt_sel2timer_cb(void *opaque); +void arm_gt_sel2vtimer_cb(void *opaque); unsigned int gt_cntfrq_period_ns(ARMCPU *cpu); void gt_rme_post_el_change(ARMCPU *cpu, void *opaque); diff --git a/target/arm/gtimer.h b/target/arm/gtimer.h index de016e6da3..f8f7425a5f 100644 --- a/target/arm/gtimer.h +++ b/target/arm/gtimer.h @@ -15,7 +15,9 @@ enum { GTIMER_HYP = 2, /* EL2 physical timer */ GTIMER_SEC = 3, /* EL3 physical timer */ GTIMER_HYPVIRT = 4, /* EL2 virtual timer */ -#define NUM_GTIMERS 5 + GTIMER_SEC_PEL2 = 5, /* Secure EL2 physical timer */ + GTIMER_SEC_VEL2 = 6, /* Secure EL2 virtual timer */ +#define NUM_GTIMERS 7 }; #endif diff --git a/target/arm/cpu.c b/target/arm/cpu.c index 1afa07511e..631cc2728d 100644 --- a/target/arm/cpu.c +++ b/target/arm/cpu.c @@ -2088,6 +2088,10 @@ static void arm_cpu_realizefn(DeviceState *dev, Error **errp) arm_gt_stimer_cb, cpu); cpu->gt_timer[GTIMER_HYPVIRT] = timer_new(QEMU_CLOCK_VIRTUAL, scale, arm_gt_hvtimer_cb, cpu); + cpu->gt_timer[GTIMER_SEC_PEL2] = timer_new(QEMU_CLOCK_VIRTUAL, scale, + arm_gt_sel2timer_cb, cpu); + cpu->gt_timer[GTIMER_SEC_VEL2] = timer_new(QEMU_CLOCK_VIRTUAL, scale, + arm_gt_sel2vtimer_cb, cpu); } #endif diff --git a/target/arm/helper.c b/target/arm/helper.c index 5a1b416e18..79894b4802 100644 --- a/target/arm/helper.c +++ b/target/arm/helper.c @@ -2401,6 +2401,41 @@ static CPAccessResult gt_stimer_access(CPUARMState *env, } } +static CPAccessResult gt_sel2timer_access(CPUARMState *env, + const ARMCPRegInfo *ri, + bool isread) +{ + /* + * The AArch64 register view of the secure EL2 timers are mostly + * accessible from EL3 and EL2 although can also be trapped to EL2 + * from EL1 depending on nested virt config. + */ + switch (arm_current_el(env)) { + case 0: + return CP_ACCESS_TRAP; + case 1: + if (!arm_is_secure(env)) { + return CP_ACCESS_TRAP_UNCATEGORIZED; + } else if (arm_hcr_el2_eff(env) & HCR_NV) { + return CP_ACCESS_TRAP_EL2; + } + return CP_ACCESS_TRAP; + case 2: + if (!arm_is_secure(env)) { + return CP_ACCESS_TRAP_UNCATEGORIZED; + } + return CP_ACCESS_OK; + case 3: + if (env->cp15.scr_el3 & SCR_EEL2) { + return CP_ACCESS_OK; + } else { + return CP_ACCESS_TRAP_UNCATEGORIZED; + } + default: + g_assert_not_reached(); + } +} + uint64_t gt_get_countervalue(CPUARMState *env) { ARMCPU *cpu = env_archcpu(env); @@ -2477,6 +2512,7 @@ static void gt_recalc_timer(ARMCPU *cpu, int timeridx) switch (timeridx) { case GTIMER_VIRT: case GTIMER_HYPVIRT: + case GTIMER_SEC_VEL2: offset = cpu->env.cp15.cntvoff_el2; break; default: @@ -2591,6 +2627,7 @@ static uint64_t gt_tval_read(CPUARMState *env, const ARMCPRegInfo *ri, switch (timeridx) { case GTIMER_VIRT: case GTIMER_HYPVIRT: + case GTIMER_SEC_VEL2: offset = gt_virt_cnt_offset(env); break; case GTIMER_PHYS: @@ -2611,6 +2648,7 @@ static void gt_tval_write(CPUARMState *env, const ARMCPRegInfo *ri, switch (timeridx) { case GTIMER_VIRT: case GTIMER_HYPVIRT: + case GTIMER_SEC_VEL2: offset = gt_virt_cnt_offset(env); break; case GTIMER_PHYS: @@ -2919,6 +2957,62 @@ static void gt_sec_ctl_write(CPUARMState *env, const ARMCPRegInfo *ri, gt_ctl_write(env, ri, GTIMER_SEC, value); } +static void gt_sec_pel2_timer_reset(CPUARMState *env, const ARMCPRegInfo *ri) +{ + gt_timer_reset(env, ri, GTIMER_SEC_PEL2); +} + +static void gt_sec_pel2_cval_write(CPUARMState *env, const ARMCPRegInfo *ri, + uint64_t value) +{ + gt_cval_write(env, ri, GTIMER_SEC_PEL2, value); +} + +static uint64_t gt_sec_pel2_tval_read(CPUARMState *env, const ARMCPRegInfo *ri) +{ + return gt_tval_read(env, ri, GTIMER_SEC_PEL2); +} + +static void gt_sec_pel2_tval_write(CPUARMState *env, const ARMCPRegInfo *ri, + uint64_t value) +{ + gt_tval_write(env, ri, GTIMER_SEC_PEL2, value); +} + +static void gt_sec_pel2_ctl_write(CPUARMState *env, const ARMCPRegInfo *ri, + uint64_t value) +{ + gt_ctl_write(env, ri, GTIMER_SEC_PEL2, value); +} + +static void gt_sec_vel2_timer_reset(CPUARMState *env, const ARMCPRegInfo *ri) +{ + gt_timer_reset(env, ri, GTIMER_SEC_VEL2); +} + +static void gt_sec_vel2_cval_write(CPUARMState *env, const ARMCPRegInfo *ri, + uint64_t value) +{ + gt_cval_write(env, ri, GTIMER_SEC_VEL2, value); +} + +static uint64_t gt_sec_vel2_tval_read(CPUARMState *env, const ARMCPRegInfo *ri) +{ + return gt_tval_read(env, ri, GTIMER_SEC_VEL2); +} + +static void gt_sec_vel2_tval_write(CPUARMState *env, const ARMCPRegInfo *ri, + uint64_t value) +{ + gt_tval_write(env, ri, GTIMER_SEC_VEL2, value); +} + +static void gt_sec_vel2_ctl_write(CPUARMState *env, const ARMCPRegInfo *ri, + uint64_t value) +{ + gt_ctl_write(env, ri, GTIMER_SEC_VEL2, value); +} + static void gt_hv_timer_reset(CPUARMState *env, const ARMCPRegInfo *ri) { gt_timer_reset(env, ri, GTIMER_HYPVIRT); @@ -2975,6 +3069,20 @@ void arm_gt_stimer_cb(void *opaque) gt_recalc_timer(cpu, GTIMER_SEC); } +void arm_gt_sel2timer_cb(void *opaque) +{ + ARMCPU *cpu = opaque; + + gt_recalc_timer(cpu, GTIMER_SEC_PEL2); +} + +void arm_gt_sel2vtimer_cb(void *opaque) +{ + ARMCPU *cpu = opaque; + + gt_recalc_timer(cpu, GTIMER_SEC_VEL2); +} + void arm_gt_hvtimer_cb(void *opaque) { ARMCPU *cpu = opaque; @@ -5696,6 +5804,56 @@ static const ARMCPRegInfo el2_sec_cp_reginfo[] = { .access = PL2_RW, .accessfn = sel2_access, .nv2_redirect_offset = 0x48, .fieldoffset = offsetof(CPUARMState, cp15.vstcr_el2) }, +#ifndef CONFIG_USER_ONLY + /* Secure EL2 Physical Timer */ + { .name = "CNTHPS_TVAL_EL2", .state = ARM_CP_STATE_AA64, + .opc0 = 3, .opc1 = 4, .crn = 14, .crm = 5, .opc2 = 0, + .type = ARM_CP_NO_RAW | ARM_CP_IO, .access = PL2_RW, + .accessfn = gt_sel2timer_access, + .readfn = gt_sec_pel2_tval_read, + .writefn = gt_sec_pel2_tval_write, + .resetfn = gt_sec_pel2_timer_reset, + }, + { .name = "CNTHPS_CTL_EL2", .state = ARM_CP_STATE_AA64, + .opc0 = 3, .opc1 = 4, .crn = 14, .crm = 5, .opc2 = 1, + .type = ARM_CP_IO, .access = PL2_RW, + .accessfn = gt_sel2timer_access, + .fieldoffset = offsetof(CPUARMState, cp15.c14_timer[GTIMER_SEC_PEL2].ctl), + .resetvalue = 0, + .writefn = gt_sec_pel2_ctl_write, .raw_writefn = raw_write, + }, + { .name = "CNTHPS_CVAL_EL2", .state = ARM_CP_STATE_AA64, + .opc0 = 3, .opc1 = 4, .crn = 14, .crm = 5, .opc2 = 2, + .type = ARM_CP_IO, .access = PL2_RW, + .accessfn = gt_sel2timer_access, + .fieldoffset = offsetof(CPUARMState, cp15.c14_timer[GTIMER_SEC_PEL2].cval), + .writefn = gt_sec_pel2_cval_write, .raw_writefn = raw_write, + }, + /* Secure EL2 Virtual Timer */ + { .name = "CNTHVS_TVAL_EL2", .state = ARM_CP_STATE_AA64, + .opc0 = 3, .opc1 = 4, .crn = 14, .crm = 4, .opc2 = 0, + .type = ARM_CP_NO_RAW | ARM_CP_IO, .access = PL2_RW, + .accessfn = gt_sel2timer_access, + .readfn = gt_sec_vel2_tval_read, + .writefn = gt_sec_vel2_tval_write, + .resetfn = gt_sec_vel2_timer_reset, + }, + { .name = "CNTHVS_CTL_EL2", .state = ARM_CP_STATE_AA64, + .opc0 = 3, .opc1 = 4, .crn = 14, .crm = 4, .opc2 = 1, + .type = ARM_CP_IO, .access = PL2_RW, + .accessfn = gt_sel2timer_access, + .fieldoffset = offsetof(CPUARMState, cp15.c14_timer[GTIMER_SEC_VEL2].ctl), + .resetvalue = 0, + .writefn = gt_sec_vel2_ctl_write, .raw_writefn = raw_write, + }, + { .name = "CNTHVS_CVAL_EL2", .state = ARM_CP_STATE_AA64, + .opc0 = 3, .opc1 = 4, .crn = 14, .crm = 4, .opc2 = 2, + .type = ARM_CP_IO, .access = PL2_RW, + .accessfn = gt_sel2timer_access, + .fieldoffset = offsetof(CPUARMState, cp15.c14_timer[GTIMER_SEC_VEL2].cval), + .writefn = gt_sec_vel2_cval_write, .raw_writefn = raw_write, + }, +#endif }; static CPAccessResult nsacr_access(CPUARMState *env, const ARMCPRegInfo *ri, From patchwork Wed Dec 18 18:15:10 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Alex_Benn=C3=A9e?= X-Patchwork-Id: 13914021 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id D9B38E77187 for ; Wed, 18 Dec 2024 18:18:31 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tNybH-0001s0-AT; Wed, 18 Dec 2024 13:16:47 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1tNya2-0001B9-BR for qemu-devel@nongnu.org; Wed, 18 Dec 2024 13:15:30 -0500 Received: from mail-ej1-x630.google.com ([2a00:1450:4864:20::630]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1tNyZy-0007Uy-Bv for qemu-devel@nongnu.org; Wed, 18 Dec 2024 13:15:28 -0500 Received: by mail-ej1-x630.google.com with SMTP id a640c23a62f3a-aa67f31a858so1249098766b.2 for ; Wed, 18 Dec 2024 10:15:14 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1734545714; x=1735150514; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=qgbFUsQ4LmsnQTjxQWiCGeGbjUd9LSSKaKM5ICyfigY=; b=UjyIva9XScvdl7q79LKn/PUlbq9D16pI1nvHdhX0+h2WOJnPsLt6YjgmcwrnJdMGXB YFDI0pp4MjyT7bVtwV4EFkXo2b9Aaghz5UDNkOrWQ1htemxd+0LzsKaEDVCkuShLvkGc 8jaNiuxjcRyyShpq2r/6hCmJSj/ijZbZwqq0DN9irLjQ27exab5Ya+3oLDW7rpweEEWe ETfRFJP50eLwlzvhZhV3/iBEv0vlgQ3u27p1Sk+DenKYXWjIQ3iTpSnZ9/nE8bduoe9O WgGvqeZ52B2nMNQYKxkujFxvLROtsMoCIRTkOUCCf65MeCAKFaGjBJR+h/FYPxHSBSR5 NnrA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1734545714; x=1735150514; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=qgbFUsQ4LmsnQTjxQWiCGeGbjUd9LSSKaKM5ICyfigY=; b=P+qFghOrDwfEypZwKB+h5tLsyELE6GXUU5HNnV2Cc21Kkac3FiM12Pk9fkEAW784KC wStBUtjcOJOkDnjoM0HEjUMcIeiM5xZ5s7f/phBNXkH5jyz3OJpcGBgV/eXSLOr+AgyA OCnVUz4Z/lMWSeVjOQkeGwParnXCUJSOPs0QFwO4v8n53RSFz9b4qABxF3iqM6CEgoAM kGQqJEeyrgrbVwGFIBsZyuUz5HH6MRflsslUE5JqsUyIWTYp8KNEgE9HAXiZcrjXjJTf yJEjq6SZZJtVv39hZ2NyvY/Jj1XTHRVaa1UCG8ssMuejlB20rQuIehA/gpf3X8YfXrsy ZHAA== X-Gm-Message-State: AOJu0YyLYC07PHSF2EfiytxgRodgt58NZhd6yQxiHSARc8WXafkm9iEq dR5/mU8iKQIEza1KCNqyxnvuBLDdC9O6bp6UIjnchjhuNbBDG0M0YdCeno5+ji7LuDuoJTpCVn2 5oV0= X-Gm-Gg: ASbGncsWzDQtc/Py+0c0I/yWbYtnds+w6yBRTq0NGaFY6/gL62hTRwMwR2P3FWQqjcC ytEhWOutl66BDM4R9742fFBeLMAEz0mcGmpo2NRS5jNNKuLLOj6baSy4g8lwsxzRxcoJ1gQBxfQ OHydbGHN/BrdYFwTlWJn6UCg6AokoVDy5BPliQcPoACXXXzaSUOG6NArKsan/+HcDAczGaDZp0x amUNvKzVybykoVk5S9hl1y7rObbV1OCwoXJ9LYsNg7ozj/VDPoSqHs= X-Google-Smtp-Source: AGHT+IGlI3D037XhUxhdKceDV/mqTJVrlNN1aGxKmJ3y4eteF39E3EeesiGODWa8khyF92qV+qfM+w== X-Received: by 2002:a17:906:31da:b0:aa6:691f:20a9 with SMTP id a640c23a62f3a-aac078bfe69mr39233966b.4.1734545713494; Wed, 18 Dec 2024 10:15:13 -0800 (PST) Received: from draig.lan ([85.9.250.243]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-aabc71ef8fbsm338376766b.165.2024.12.18.10.15.12 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 18 Dec 2024 10:15:12 -0800 (PST) Received: from draig.lan (localhost [IPv6:::1]) by draig.lan (Postfix) with ESMTP id CF6495FC8A; Wed, 18 Dec 2024 18:15:11 +0000 (GMT) From: =?utf-8?q?Alex_Benn=C3=A9e?= To: qemu-devel@nongnu.org Cc: Leif Lindholm , Leif Lindholm , Marcin Juszkiewicz , Peter Maydell , Radoslaw Biernacki , qemu-arm@nongnu.org, =?utf-8?q?Alex_?= =?utf-8?q?Benn=C3=A9e?= , qemu-stable@nongnu.org Subject: [PATCH v2 4/5] hw/arm: enable secure EL2 timers for virt machine Date: Wed, 18 Dec 2024 18:15:10 +0000 Message-Id: <20241218181511.3575613-5-alex.bennee@linaro.org> X-Mailer: git-send-email 2.39.5 In-Reply-To: <20241218181511.3575613-1-alex.bennee@linaro.org> References: <20241218181511.3575613-1-alex.bennee@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::630; envelope-from=alex.bennee@linaro.org; helo=mail-ej1-x630.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=unavailable autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Signed-off-by: Alex Bennée Cc: qemu-stable@nongnu.org --- hw/arm/virt.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/hw/arm/virt.c b/hw/arm/virt.c index 333eaf67ea..5e3589dc6a 100644 --- a/hw/arm/virt.c +++ b/hw/arm/virt.c @@ -873,6 +873,8 @@ static void create_gic(VirtMachineState *vms, MemoryRegion *mem) [GTIMER_HYP] = ARCH_TIMER_NS_EL2_IRQ, [GTIMER_SEC] = ARCH_TIMER_S_EL1_IRQ, [GTIMER_HYPVIRT] = ARCH_TIMER_NS_EL2_VIRT_IRQ, + [GTIMER_SEC_PEL2] = ARCH_TIMER_S_EL2_IRQ, + [GTIMER_SEC_VEL2] = ARCH_TIMER_S_EL2_VIRT_IRQ, }; for (unsigned irq = 0; irq < ARRAY_SIZE(timer_irq); irq++) { From patchwork Wed Dec 18 18:15:11 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Alex_Benn=C3=A9e?= X-Patchwork-Id: 13914018 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 59080E77188 for ; Wed, 18 Dec 2024 18:18:05 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tNyb8-0001hh-Jl; Wed, 18 Dec 2024 13:16:38 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1tNya3-0001BF-ER for qemu-devel@nongnu.org; Wed, 18 Dec 2024 13:15:39 -0500 Received: from mail-ej1-x631.google.com ([2a00:1450:4864:20::631]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1tNyZy-0007Vo-CI for qemu-devel@nongnu.org; Wed, 18 Dec 2024 13:15:29 -0500 Received: by mail-ej1-x631.google.com with SMTP id a640c23a62f3a-aa6c0d1833eso1217956566b.1 for ; Wed, 18 Dec 2024 10:15:16 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1734545715; x=1735150515; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=qe//gJViys+yhtB7j7EeuPsosME5JBmgNhwY0OmT6DE=; b=fuV+O5jGEazW/kMYEL7vhf1bv9G3mcDeXU8uivlmCmHvNiYD/hWOfNK5G8merW+b9f URvjLqlN3iex0D/v9K/6/xcbOQCj/tZ9udBvh4C1+DZbGjm21o/BIoOfR5Eus+cceh1E nw+uUCd8pyfA5pG1ChLFs6Gh2b2wVzsG2mva7W2corRMNKC17PbI5ezuo58ZvHNd0jMb klncAtK6KRY2+MQlQ6Zoafvcl0Y2iBHcHo8fdmUSKk9+EXJeoxJxHInk7tYjRqi4mJsN XRjOr1LIkILD7NE/LgHYGlxRakPcLr+wKHiir4FucDhuukS3yjVE3ab7MB6U64aArGSA ShFg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1734545715; x=1735150515; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=qe//gJViys+yhtB7j7EeuPsosME5JBmgNhwY0OmT6DE=; b=uWGDtA0NdD3BiV9g9QkbxpYCOUgd76jyncyUMunq2+4qVKuZcLBjoZWDeZvBgORz+V HcQ1H8WlRZS0jblWnp5NeKNcTlYue3SaSKKSwOkeA4Q6AUmB610TvZo0KqP4VQ6sZFck eoUVk/GJPeN24/JR9lJbuo0xDUVmleba6u8sQMzRC7g2rbTFEAUPAkLSTI3wQ5VwpD85 6bsKX4HW1YSO6XZkF+42eog2/VnxYxfRKkNe+LnWxE55AkI14ne9Zl/RqzMY377oSzS1 kbsoqUGBbzi5IY714JbFCmuseQG1fup7Ykwy7XHLGxTl/ZkeObLQ78G+RJUpZWoVuts8 ljTQ== X-Gm-Message-State: AOJu0Yyzq2OeNBwGpkf7nE4kfRZKmuirf0kgIRLHA1P+ZYigWu2chmiS Qs9GCKr/eMygGxd5w6AyxD5/1q8RHITK0kijHNqkH3BSbkfPBvmPD3H1vKizKH0= X-Gm-Gg: ASbGncvON4ZkjB6e9mA3qDLAeR6lR2yvQv2FpIgo4ZXE0Vz2E58P5Jwl1Nhy2pnHWAo qzvJ6Jnsux0sBjp7bTkvt0qkRpZu7qjglNdf72okr0VBCarZxOEprZVCkNEb8+PjYAaq4VB/RlQ wfW6YGyYzczvuTaq5HwAGfD1an4zNLLJcYhuyDjDnqGfleyabDYYaBFEqRiwKl7wV6VahKfuRz5 Y7gIjfuxa7BZPKWqPz1/N4fix5Y8dBF0Pf9+wCbJxoIpVe8p5F1Q7s= X-Google-Smtp-Source: AGHT+IEWg0lGJTdmj7iVoVggh5TZTrqiosrV2csXvzuMSzzLJdVA/ws4t9a4otc43XJj/nNSQO8Xfg== X-Received: by 2002:a17:906:319a:b0:aab:7467:3f70 with SMTP id a640c23a62f3a-aabf471905bmr341369766b.2.1734545715455; Wed, 18 Dec 2024 10:15:15 -0800 (PST) Received: from draig.lan ([85.9.250.243]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-aab96006c2fsm578533666b.9.2024.12.18.10.15.13 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 18 Dec 2024 10:15:14 -0800 (PST) Received: from draig.lan (localhost [IPv6:::1]) by draig.lan (Postfix) with ESMTP id E685B5FC9D; Wed, 18 Dec 2024 18:15:11 +0000 (GMT) From: =?utf-8?q?Alex_Benn=C3=A9e?= To: qemu-devel@nongnu.org Cc: Leif Lindholm , Leif Lindholm , Marcin Juszkiewicz , Peter Maydell , Radoslaw Biernacki , qemu-arm@nongnu.org, =?utf-8?q?Alex_?= =?utf-8?q?Benn=C3=A9e?= , qemu-stable@nongnu.org Subject: [PATCH v2 5/5] hw/arm: enable secure EL2 timers for sbsa machine Date: Wed, 18 Dec 2024 18:15:11 +0000 Message-Id: <20241218181511.3575613-6-alex.bennee@linaro.org> X-Mailer: git-send-email 2.39.5 In-Reply-To: <20241218181511.3575613-1-alex.bennee@linaro.org> References: <20241218181511.3575613-1-alex.bennee@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::631; envelope-from=alex.bennee@linaro.org; helo=mail-ej1-x631.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=unavailable autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Signed-off-by: Alex Bennée Cc: qemu-stable@nongnu.org Reviewed-by: Peter Maydell --- hw/arm/sbsa-ref.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/hw/arm/sbsa-ref.c b/hw/arm/sbsa-ref.c index e3195d5449..c02344004e 100644 --- a/hw/arm/sbsa-ref.c +++ b/hw/arm/sbsa-ref.c @@ -484,6 +484,8 @@ static void create_gic(SBSAMachineState *sms, MemoryRegion *mem) [GTIMER_HYP] = ARCH_TIMER_NS_EL2_IRQ, [GTIMER_SEC] = ARCH_TIMER_S_EL1_IRQ, [GTIMER_HYPVIRT] = ARCH_TIMER_NS_EL2_VIRT_IRQ, + [GTIMER_SEC_PEL2] = ARCH_TIMER_S_EL2_IRQ, + [GTIMER_SEC_VEL2] = ARCH_TIMER_S_EL2_VIRT_IRQ, }; for (irq = 0; irq < ARRAY_SIZE(timer_irq); irq++) {