From nobody Thu May 16 19:07:36 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1611918294; cv=none; d=zohomail.com; s=zohoarc; b=OL+r5JWxqdZgPWaK4LaV6Lvbt1kuCSHC4NciuVFHu4t/wpGhheC4am9XLk5/ai8QkCP0bYYTO6S1SyqzlLmjnUjbFzhWe8QO0g7NudVC/t5DQM1b2SQU/uYvgkCDyUN5GCEasauPOxqIekkv9+S9Dmahf5pEWkpq04+OR6VR0Ak= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1611918294; h=Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=ZkKoXRPBApffD0MVNlI1cfOJ0LjvP5jIStY6aHbrYvw=; b=R4ZuK5A+CVkEo3F7Hk51Fa3j3EeiFfUHlIy7M0DtlVtmC/VisCSIOiDpI9L/Q92RjaeA1utgz4DQCL7niboU0GiAhspBPzweQw8gXctWaZzigdZMOjtYAGqtG56MQWt8h9+CwMmQXnGS7YX8JqYZWCY14OgUBaLFogPSGxexQko= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1611918294466435.4444763621359; Fri, 29 Jan 2021 03:04:54 -0800 (PST) Received: from localhost ([::1]:42764 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1l5Ra9-00018S-B2 for importer@patchew.org; Fri, 29 Jan 2021 06:04:53 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:59548) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1l5RVx-0004En-S7 for qemu-devel@nongnu.org; Fri, 29 Jan 2021 06:00:33 -0500 Received: from mail-wm1-x32e.google.com ([2a00:1450:4864:20::32e]:52736) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1l5RVi-0006rI-2q for qemu-devel@nongnu.org; Fri, 29 Jan 2021 06:00:31 -0500 Received: by mail-wm1-x32e.google.com with SMTP id z16so4190764wml.2 for ; Fri, 29 Jan 2021 03:00:17 -0800 (PST) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [81.2.115.148]) by smtp.gmail.com with ESMTPSA id w20sm9268761wmm.12.2021.01.29.03.00.15 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 29 Jan 2021 03:00:15 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:subject:date:message-id:in-reply-to:references:mime-version :content-transfer-encoding; bh=ZkKoXRPBApffD0MVNlI1cfOJ0LjvP5jIStY6aHbrYvw=; b=NKxv1P4MB4XbN3ZewdPH/j8n77nNSB/vlYFKmvJlLSoCMpGtQacrPa2mJcMppaMNDH rSvxSZdufHrzlXhq8j1QLoLPbJYKAYA96bjugJjqShWUG9UlOJqMSI0VawmSGT25sC+A iqBJUtOocYxadwORw7dS9O+FFYxGymmk68jvlj1mhEhduJnxhGqgocoVGGNLY67O6Kbx xUuA+UfldXln32U4PwcgQPVkuBpQvfwhUDpH+UUlzwrCRul3cyFHW85LXggq5LHY294R 1OK0qQ5gbSnhbqx8N+rOWY2+2wfCNdUcLNTHx8sEASNOMyA2KYJtw6vZQu36/x3utok7 k4nw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=ZkKoXRPBApffD0MVNlI1cfOJ0LjvP5jIStY6aHbrYvw=; b=ueYLRgUS6j4HxpnCik0ayTmgC4A5XPtr59Bp05WU2gGFnmYbRtH3NWygDc/wLqzYSl wv6Re0L7XIiftLqzgek9WzrqeZ8yEIZ6LQw4vNYWS/tHSKy01IlkGEiYnM9Q3OIsJIoS MTV8+xLo0lkgisVKpfDG5qPRe8+UosonTtHYEM/WMTgKJ3uFXSTGv1K4+3Sul6aLV2Z+ WG6lDeORO8b6t+25ope8bHXRLNq9o94TT7auJlhZu0etznmkiK8/vTL3/VzDAldaLqii Tj6+ipoIBeQAeANUmbJacWuHMd0ndMT3MTSDDOnPA3pnOP06pOp0eyRbHulBAQOIZW6u Ow5w== X-Gm-Message-State: AOAM530l8VSOEfQBryaFNQXe1xeLHcOfDSAnqhW19y4jujMF3wlm97Mj Q46Bp7NMpWMe5zTO0BIQlLfYGmkudmGYtg== X-Google-Smtp-Source: ABdhPJzgjLRjJ/L+LnVgsy3hhusUYrY5lDIUpF68vnrJh4BR8jMqCEkjWX143MB2yblPcTkBQgVuTA== X-Received: by 2002:a05:600c:214c:: with SMTP id v12mr3273425wml.8.1611918016225; Fri, 29 Jan 2021 03:00:16 -0800 (PST) From: Peter Maydell To: qemu-devel@nongnu.org Subject: [PULL 01/46] target/arm: Implement ID_PFR2 Date: Fri, 29 Jan 2021 10:59:27 +0000 Message-Id: <20210129110012.8660-2-peter.maydell@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20210129110012.8660-1-peter.maydell@linaro.org> References: <20210129110012.8660-1-peter.maydell@linaro.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2a00:1450:4864:20::32e; envelope-from=peter.maydell@linaro.org; helo=mail-wm1-x32e.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.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @linaro.org) Content-Type: text/plain; charset="utf-8" From: Richard Henderson This was defined at some point before ARMv8.4, and will shortly be used by new processor descriptions. Reviewed-by: Peter Maydell Signed-off-by: Richard Henderson Message-id: 20210120204400.1056582-1-richard.henderson@linaro.org Signed-off-by: Peter Maydell --- target/arm/cpu.h | 1 + target/arm/helper.c | 4 ++-- target/arm/kvm64.c | 2 ++ 3 files changed, 5 insertions(+), 2 deletions(-) diff --git a/target/arm/cpu.h b/target/arm/cpu.h index df0d6778330..d080239863c 100644 --- a/target/arm/cpu.h +++ b/target/arm/cpu.h @@ -922,6 +922,7 @@ struct ARMCPU { uint32_t id_mmfr4; uint32_t id_pfr0; uint32_t id_pfr1; + uint32_t id_pfr2; uint32_t mvfr0; uint32_t mvfr1; uint32_t mvfr2; diff --git a/target/arm/helper.c b/target/arm/helper.c index d2ead3fcbdb..417777d4bed 100644 --- a/target/arm/helper.c +++ b/target/arm/helper.c @@ -7662,11 +7662,11 @@ void register_cp_regs_for_features(ARMCPU *cpu) .access =3D PL1_R, .type =3D ARM_CP_CONST, .accessfn =3D access_aa64_tid3, .resetvalue =3D 0 }, - { .name =3D "MVFR4_EL1_RESERVED", .state =3D ARM_CP_STATE_AA64, + { .name =3D "ID_PFR2", .state =3D ARM_CP_STATE_BOTH, .opc0 =3D 3, .opc1 =3D 0, .crn =3D 0, .crm =3D 3, .opc2 =3D = 4, .access =3D PL1_R, .type =3D ARM_CP_CONST, .accessfn =3D access_aa64_tid3, - .resetvalue =3D 0 }, + .resetvalue =3D cpu->isar.id_pfr2 }, { .name =3D "MVFR5_EL1_RESERVED", .state =3D ARM_CP_STATE_AA64, .opc0 =3D 3, .opc1 =3D 0, .crn =3D 0, .crm =3D 3, .opc2 =3D = 5, .access =3D PL1_R, .type =3D ARM_CP_CONST, diff --git a/target/arm/kvm64.c b/target/arm/kvm64.c index f74bac24574..3c37fc4fb6a 100644 --- a/target/arm/kvm64.c +++ b/target/arm/kvm64.c @@ -578,6 +578,8 @@ bool kvm_arm_get_host_cpu_features(ARMHostCPUFeatures *= ahcf) ARM64_SYS_REG(3, 0, 0, 1, 0)); err |=3D read_sys_reg32(fdarray[2], &ahcf->isar.id_pfr1, ARM64_SYS_REG(3, 0, 0, 1, 1)); + err |=3D read_sys_reg32(fdarray[2], &ahcf->isar.id_pfr2, + ARM64_SYS_REG(3, 0, 0, 3, 4)); err |=3D read_sys_reg32(fdarray[2], &ahcf->isar.id_dfr0, ARM64_SYS_REG(3, 0, 0, 1, 2)); err |=3D read_sys_reg32(fdarray[2], &ahcf->isar.id_mmfr0, --=20 2.20.1 From nobody Thu May 16 19:07:36 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1611918153; cv=none; d=zohomail.com; s=zohoarc; b=nFPEqKRCNW3rjZ/PjBSl39aekLiqJ1roUgMGcHDoyKv5Bt9dMa910zzSk8eiBitQojD/NjVpuySevMOqS2EaDHr+Hp/hIbb/49GG2tLC1daFe/pMwH8NF7Ri1yfyq46tsBgRPp0B7YygX2jCHrfI4L0U2bcKAOtlLgsccq/Pb00= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1611918153; h=Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=eJCw4eHH3Spgo4adrfmSpNJj4lzDDpBeLfEpC7k+CtQ=; b=eBnsbYfBxauk0lqWvc6d3bJFkK+nXooVYaR8BQbxmcYwB1uEZ+4lIlUavkLtCWWhyH6BqnKODrJdcxpp9QTRhnobqQi/hMVLnIghd2yykU3FJNovjVEn/BKLEbyJPooqAsmKB2Sstq1Nye+gnO/H7RFxQevEmoBi7NnYMuD1+5g= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1611918153937612.5430848627004; Fri, 29 Jan 2021 03:02:33 -0800 (PST) Received: from localhost ([::1]:34332 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1l5RXs-0006Bg-LP for importer@patchew.org; Fri, 29 Jan 2021 06:02:32 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:59584) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1l5RW0-0004Go-FQ for qemu-devel@nongnu.org; Fri, 29 Jan 2021 06:00:36 -0500 Received: from mail-wm1-x32a.google.com ([2a00:1450:4864:20::32a]:37386) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1l5RVk-0006rg-3k for qemu-devel@nongnu.org; Fri, 29 Jan 2021 06:00:34 -0500 Received: by mail-wm1-x32a.google.com with SMTP id m1so3541710wml.2 for ; Fri, 29 Jan 2021 03:00:17 -0800 (PST) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [81.2.115.148]) by smtp.gmail.com with ESMTPSA id w20sm9268761wmm.12.2021.01.29.03.00.16 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 29 Jan 2021 03:00:16 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:subject:date:message-id:in-reply-to:references:mime-version :content-transfer-encoding; bh=eJCw4eHH3Spgo4adrfmSpNJj4lzDDpBeLfEpC7k+CtQ=; b=x83nVstFTMr6K88yH4jY3hzVQ6OWcnbXkPSLCr/2kh6VDwZ90cea2A2EBHAye5DQ1o RUD6YVwz/530t6rTrW/4Rj8GhrKBRWT7sbfi6pJAKYPJFhE3OoZKxoUGuVEzUsGS5NLt ZSQEkIY2AsK9cYfpAeHKGyNWsy8J17uLylIUajWeE+Aw9J9bDmbvnBufsu91d6XH6d0i POTFUqKzLReNw4BztLw6SoZQuKy3ugR6ATCG3rp0TC0sndavrSu+MkAz1G1GkCOTifCs kV3ZKXafTSM9g45v8sivm1Oecaf5mixmFhdodt7l8b35P+P2AEC/trYJTzUArdvHGQDN IqRg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=eJCw4eHH3Spgo4adrfmSpNJj4lzDDpBeLfEpC7k+CtQ=; b=gHmaYtmH6vI+e30CBXqEK6rRN4V1zmNJDNBA32MaTwXiBj0YtXtuBC/Eex0j//gkrh +jUzlDullPn5PrW0XZ+tbZ2HwVr1LgqBeHKvitZc0P4xq3pTIaifJ5CbkE2sT+/qZLqa ARXxakQc3EwY9OwgruUwBs796RgZuWrAAaRp+46b7XB49cbW9FL9G4uqxEEjcb3yZKq0 8C8V2yh2DR+DfNHINkOhdgYN6ktzSC5y8nDcE5pu17l8n5yZ9BDPDTJK71uSR2zIZGfB tYQLv71qW4YCy5lFTzaoqmBTzzCJKM0batjEDKKY/gjx7rcV/KHJm///CZOJeaRKbk4J Ls5Q== X-Gm-Message-State: AOAM532n5TYkjEZVn/7bWPMcMVcjr8QBfGgsJvGc2zAv5p268rS2ZTa3 cxFdPX0OD3v8QHefXiyXkXv6NNIV2aioVg== X-Google-Smtp-Source: ABdhPJznmbMnHLbAIjObmMJTrkJI30almyl2qq6uMJYJncL4FK+/elPoFE/XIHKGgXbV2SfjdY4weQ== X-Received: by 2002:a05:600c:354b:: with SMTP id i11mr3228660wmq.72.1611918017048; Fri, 29 Jan 2021 03:00:17 -0800 (PST) From: Peter Maydell To: qemu-devel@nongnu.org Subject: [PULL 02/46] target/arm: Conditionalize DBGDIDR Date: Fri, 29 Jan 2021 10:59:28 +0000 Message-Id: <20210129110012.8660-3-peter.maydell@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20210129110012.8660-1-peter.maydell@linaro.org> References: <20210129110012.8660-1-peter.maydell@linaro.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2a00:1450:4864:20::32a; envelope-from=peter.maydell@linaro.org; helo=mail-wm1-x32a.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.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @linaro.org) Content-Type: text/plain; charset="utf-8" From: Richard Henderson Only define the register if it exists for the cpu. Signed-off-by: Richard Henderson Message-id: 20210120031656.737646-1-richard.henderson@linaro.org Reviewed-by: Peter Maydell Signed-off-by: Peter Maydell --- target/arm/helper.c | 21 +++++++++++++++------ 1 file changed, 15 insertions(+), 6 deletions(-) diff --git a/target/arm/helper.c b/target/arm/helper.c index 417777d4bed..677a4aa79e7 100644 --- a/target/arm/helper.c +++ b/target/arm/helper.c @@ -6567,11 +6567,21 @@ static void define_debug_regs(ARMCPU *cpu) */ int i; int wrps, brps, ctx_cmps; - ARMCPRegInfo dbgdidr =3D { - .name =3D "DBGDIDR", .cp =3D 14, .crn =3D 0, .crm =3D 0, .opc1 =3D= 0, .opc2 =3D 0, - .access =3D PL0_R, .accessfn =3D access_tda, - .type =3D ARM_CP_CONST, .resetvalue =3D cpu->isar.dbgdidr, - }; + + /* + * The Arm ARM says DBGDIDR is optional and deprecated if EL1 cannot + * use AArch32. Given that bit 15 is RES1, if the value is 0 then + * the register must not exist for this cpu. + */ + if (cpu->isar.dbgdidr !=3D 0) { + ARMCPRegInfo dbgdidr =3D { + .name =3D "DBGDIDR", .cp =3D 14, .crn =3D 0, .crm =3D 0, + .opc1 =3D 0, .opc2 =3D 0, + .access =3D PL0_R, .accessfn =3D access_tda, + .type =3D ARM_CP_CONST, .resetvalue =3D cpu->isar.dbgdidr, + }; + define_one_arm_cp_reg(cpu, &dbgdidr); + } =20 /* Note that all these register fields hold "number of Xs minus 1". */ brps =3D arm_num_brps(cpu); @@ -6580,7 +6590,6 @@ static void define_debug_regs(ARMCPU *cpu) =20 assert(ctx_cmps <=3D brps); =20 - define_one_arm_cp_reg(cpu, &dbgdidr); define_arm_cp_regs(cpu, debug_cp_reginfo); =20 if (arm_feature(&cpu->env, ARM_FEATURE_LPAE)) { --=20 2.20.1 From nobody Thu May 16 19:07:36 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1611918154; cv=none; d=zohomail.com; s=zohoarc; b=iON+4ACUpqdGW6hmF4CoFn3mE+OU4Di0f8/6vTINhiTa9wb3vWnYfB45tXkDbC3bxHcfkFnXDVY0M2LZmIpM/rfdorNGYZDHGgTbZu90QwC/SoI9oY2jzjDBd1X1TtRnrRXAHIQxiY+2TLY/E1glUb1J4Cs6TAheHuQUKvGro0A= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1611918154; h=Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=wDUBdfIHH7cKXu56ARpiTqgmJioSyQdGeUB4RSV9/9U=; b=e4HDvCVtKBbYz+SgDpku8ajhRbcazT/FtZh41YzW2gso0jUZpIIEaMGytRy6sW2tt87T3+C1YTDrUv4W3aGauuhGHCL3MHiYJ7L/SfyGluZ497hSSaBtHMKJHSar7ZGZ5wSbdzGrJE10HCMwII/D5bSwkPYkMLVBaIrwW0RPfRY= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1611918154258281.19726966849703; Fri, 29 Jan 2021 03:02:34 -0800 (PST) Received: from localhost ([::1]:34298 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1l5RXt-0006B0-5p for importer@patchew.org; Fri, 29 Jan 2021 06:02:33 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:59590) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1l5RW0-0004Gs-OX for qemu-devel@nongnu.org; Fri, 29 Jan 2021 06:00:36 -0500 Received: from mail-wr1-x436.google.com ([2a00:1450:4864:20::436]:40612) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1l5RVl-0006sC-Vh for qemu-devel@nongnu.org; Fri, 29 Jan 2021 06:00:36 -0500 Received: by mail-wr1-x436.google.com with SMTP id c12so8391099wrc.7 for ; Fri, 29 Jan 2021 03:00:18 -0800 (PST) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [81.2.115.148]) by smtp.gmail.com with ESMTPSA id w20sm9268761wmm.12.2021.01.29.03.00.17 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 29 Jan 2021 03:00:17 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:subject:date:message-id:in-reply-to:references:mime-version :content-transfer-encoding; bh=wDUBdfIHH7cKXu56ARpiTqgmJioSyQdGeUB4RSV9/9U=; b=Rf43R94jIXwH0uoGNRMDQyX1v/mNvwpHRqR/WpZtb80nEede3NC+LbUw/EAufXP8Ll IYn70HZ6TRQfBERdqUZGx1csHbxuAhDarpg7GTVLm54CFxw5/RkGqEvtfl2QLAD5TWRJ mlH3DkkZlrASaQWJlFdrGiviJZbob29BugYNAyIeBRieiQyoetNWE1pemRC+GomZMYmW 05tSGopMxwB0HY5Ey2L8CeHTmZPxjuaJhmcV8t9nCE71jZqmVYXO17wF9+tQUMh4i/os vf4NG93q92vWofN7p4BG7kh3t44xDnEleoMb5u1qD3eJdZ+dBT8hYNyaRqp4MLzST3tH N6ZQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=wDUBdfIHH7cKXu56ARpiTqgmJioSyQdGeUB4RSV9/9U=; b=YZFqi9EsvGYibPJovMtmja+7N/J9XYB4wib2ZvSQ69UsIK6GjyHLa8zxEudxrqSPUE 9miEtCzVLiXp9SPogeW+263C+8AkOs+vnQRJcj5CaebuFIfwzDOrXi8rX2RdtNn3MhIG 8ZZ22v2AOyJksniO2RohzzYxqS8TWE0HsP1x0nvRuWq/sm48ErCIRBLHkFlvag2z4duK /27/pkMtZSbOww0nD5m7J3nhzNly/0n3k0v3ht+TOdw4Zpg+2vwXcmMmvX3Wa78uK5bI bCJ+tryST2wPm7VRsyqwleI9c/U3fgiicj2BJ+FoXmzmxwXAbMPTd1xdODlg4lDv6M6D m2cg== X-Gm-Message-State: AOAM531IXtf6GpMHADYyL1gwmPZJ3UgEx5aTNulDY8yXl1FDVESmK/8Y 1CbtnkaTe75T3cmvgdkIbYJvYgRlNkA+Ww== X-Google-Smtp-Source: ABdhPJyv2bb09xbQfDx/rdkwac2NpRiO1iJ2yP3HAfB8ZcSHpA9YpVN1wJZCUeQuKcnV2Vr5iWOnIQ== X-Received: by 2002:a5d:524a:: with SMTP id k10mr3905875wrc.394.1611918017881; Fri, 29 Jan 2021 03:00:17 -0800 (PST) From: Peter Maydell To: qemu-devel@nongnu.org Subject: [PULL 03/46] arm: rename xlnx-zcu102.canbusN properties Date: Fri, 29 Jan 2021 10:59:29 +0000 Message-Id: <20210129110012.8660-4-peter.maydell@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20210129110012.8660-1-peter.maydell@linaro.org> References: <20210129110012.8660-1-peter.maydell@linaro.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2a00:1450:4864:20::436; envelope-from=peter.maydell@linaro.org; helo=mail-wr1-x436.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.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @linaro.org) Content-Type: text/plain; charset="utf-8" From: Paolo Bonzini The properties to attach a CANBUS object to the xlnx-zcu102 machine have a period in them. We want to use periods in properties for compound QAPI t= ypes, and besides the "xlnx-zcu102." prefix is both unnecessary and different from any other machine property name. Remove it. Signed-off-by: Paolo Bonzini Message-id: 20210118162537.779542-1-pbonzini@redhat.com Reviewed-by: Vikram Garhwal Signed-off-by: Peter Maydell --- hw/arm/xlnx-zcu102.c | 4 ++-- tests/qtest/xlnx-can-test.c | 30 +++++++++++++++--------------- 2 files changed, 17 insertions(+), 17 deletions(-) diff --git a/hw/arm/xlnx-zcu102.c b/hw/arm/xlnx-zcu102.c index 4ef0c516bfd..c9713638c5b 100644 --- a/hw/arm/xlnx-zcu102.c +++ b/hw/arm/xlnx-zcu102.c @@ -219,12 +219,12 @@ static void xlnx_zcu102_machine_instance_init(Object = *obj) s->secure =3D false; /* Default to virt (EL2) being disabled */ s->virt =3D false; - object_property_add_link(obj, "xlnx-zcu102.canbus0", TYPE_CAN_BUS, + object_property_add_link(obj, "canbus0", TYPE_CAN_BUS, (Object **)&s->canbus[0], object_property_allow_set_link, 0); =20 - object_property_add_link(obj, "xlnx-zcu102.canbus1", TYPE_CAN_BUS, + object_property_add_link(obj, "canbus1", TYPE_CAN_BUS, (Object **)&s->canbus[1], object_property_allow_set_link, 0); diff --git a/tests/qtest/xlnx-can-test.c b/tests/qtest/xlnx-can-test.c index 3d1120005b6..54de71a6864 100644 --- a/tests/qtest/xlnx-can-test.c +++ b/tests/qtest/xlnx-can-test.c @@ -138,9 +138,9 @@ static void test_can_bus(void) uint8_t can_timestamp =3D 1; =20 QTestState *qts =3D qtest_init("-machine xlnx-zcu102" - " -object can-bus,id=3Dcanbus0" - " -machine xlnx-zcu102.canbus0=3Dcanbus0" - " -machine xlnx-zcu102.canbus1=3Dcanbus0" + " -object can-bus,id=3Dcanbus" + " -machine canbus0=3Dcanbus" + " -machine canbus1=3Dcanbus" ); =20 /* Configure the CAN0 and CAN1. */ @@ -175,9 +175,9 @@ static void test_can_loopback(void) uint32_t status =3D 0; =20 QTestState *qts =3D qtest_init("-machine xlnx-zcu102" - " -object can-bus,id=3Dcanbus0" - " -machine xlnx-zcu102.canbus0=3Dcanbus0" - " -machine xlnx-zcu102.canbus1=3Dcanbus0" + " -object can-bus,id=3Dcanbus" + " -machine canbus0=3Dcanbus" + " -machine canbus1=3Dcanbus" ); =20 /* Configure the CAN0 in loopback mode. */ @@ -223,9 +223,9 @@ static void test_can_filter(void) uint8_t can_timestamp =3D 1; =20 QTestState *qts =3D qtest_init("-machine xlnx-zcu102" - " -object can-bus,id=3Dcanbus0" - " -machine xlnx-zcu102.canbus0=3Dcanbus0" - " -machine xlnx-zcu102.canbus1=3Dcanbus0" + " -object can-bus,id=3Dcanbus" + " -machine canbus0=3Dcanbus" + " -machine canbus1=3Dcanbus" ); =20 /* Configure the CAN0 and CAN1. */ @@ -271,9 +271,9 @@ static void test_can_sleepmode(void) uint8_t can_timestamp =3D 1; =20 QTestState *qts =3D qtest_init("-machine xlnx-zcu102" - " -object can-bus,id=3Dcanbus0" - " -machine xlnx-zcu102.canbus0=3Dcanbus0" - " -machine xlnx-zcu102.canbus1=3Dcanbus0" + " -object can-bus,id=3Dcanbus" + " -machine canbus0=3Dcanbus" + " -machine canbus1=3Dcanbus" ); =20 /* Configure the CAN0. */ @@ -317,9 +317,9 @@ static void test_can_snoopmode(void) uint8_t can_timestamp =3D 1; =20 QTestState *qts =3D qtest_init("-machine xlnx-zcu102" - " -object can-bus,id=3Dcanbus0" - " -machine xlnx-zcu102.canbus0=3Dcanbus0" - " -machine xlnx-zcu102.canbus1=3Dcanbus0" + " -object can-bus,id=3Dcanbus" + " -machine canbus0=3Dcanbus" + " -machine canbus1=3Dcanbus" ); =20 /* Configure the CAN0. */ --=20 2.20.1 From nobody Thu May 16 19:07:36 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1611918703; cv=none; d=zohomail.com; s=zohoarc; b=eyxEiH1cQEieaO2NYQe/8mGItpESvgNKiExaR5DO9ZKe7575pKFv0LUZ+pEG88mxLFfOgN4ThznfVBDlP2XJjuBPDucvxZsZl7DqhVaqh+HgBBwhKLtl75Nkmn0SknmhavzMnr+jGAX9z/8PuszRGqxy2HnDOFcvBFvtRsYr2Zs= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1611918703; h=Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=y8CbVorX8oRoSIK6UA9YF8aMcueMF25dEqRylmS49Oo=; b=TzbLWiFCoqpH4lmOqAd6JroYd6WXnBgPLUzUkr56yABuESTAwfHOaBSraznlISBXFbTZd0/oZsLd+JZIzXmiMt3loOtIV0LNvTZiyf6jGYW4YS0B/g150g3In1hDJiDsMnCdM/QDiYtjZSpDNcapbEXl/fi4lm7MhMFnFtGMsVY= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 161191870379397.29290256500133; Fri, 29 Jan 2021 03:11:43 -0800 (PST) Received: from localhost ([::1]:40140 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1l5Rgk-0003Cn-ME for importer@patchew.org; Fri, 29 Jan 2021 06:11:42 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:59660) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1l5RW4-0004QJ-9B for qemu-devel@nongnu.org; Fri, 29 Jan 2021 06:00:40 -0500 Received: from mail-wm1-x32b.google.com ([2a00:1450:4864:20::32b]:36434) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1l5RVl-0006t8-TV for qemu-devel@nongnu.org; Fri, 29 Jan 2021 06:00:39 -0500 Received: by mail-wm1-x32b.google.com with SMTP id i9so6831037wmq.1 for ; Fri, 29 Jan 2021 03:00:19 -0800 (PST) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [81.2.115.148]) by smtp.gmail.com with ESMTPSA id w20sm9268761wmm.12.2021.01.29.03.00.18 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 29 Jan 2021 03:00:18 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:subject:date:message-id:in-reply-to:references:mime-version :content-transfer-encoding; bh=y8CbVorX8oRoSIK6UA9YF8aMcueMF25dEqRylmS49Oo=; b=W5DX/GeMPN/Q+bZmmLiyX49kvzbetnBH1sFexGudUNYnaXnzJm1/7J0Kf+7ecRENG4 0sTKEjtyucxP2ltFCG4yJMFhG87zc7SnvaJylHkMs/HNY5WaOp3xXCog6sMqEL77SsB8 DBmSwLvWTfrzWH1nZ7nk9PwqfLAwYYnMnZKvzY+KTtl77VZj1S6EtunkcTBqEnrONldf pZOLDqaSZZSI8YjE6vNhdvYlwsgeI9eZY7xl2+30br+3ye5DVKG4t2Tx1TUOFBlin2Sa CuNV6JC5zzO5SRA2ngK9HfVig8n+5HdsfgIboV5hnW0Jhi6/lbVKLkpjRLBZLSCws+QK YPkg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=y8CbVorX8oRoSIK6UA9YF8aMcueMF25dEqRylmS49Oo=; b=H3y7SYTD7AZT1y9dNnOQOXnwkCB+Jzt5IM4+NxTKOScZ4XBixsskviDErEURcaJEYQ aFORbn44ItMqeXY/bU35FRaoEDt/LQcL4veJIBYbihGki4hQxe5NXib6QNTifvvnriIX tSxtFSW3KpWFej6ouoPh+ehfExjlePnma+UmQg9FYcW+vz2NOmu5n8mCR15tKtkUu0y/ 43LJU+p3ABg7drh1c55n0N8bGn22Fv5EDPbgaQkwBoi/5TC0ziyj/iMrNdXzAlAMzW98 k4YkmEf/NnV5fKTJu25fEnltWWbMknwrYiyoOZNjnV8xrxWrGU4enlzFMouMKsCyDEl6 uR0A== X-Gm-Message-State: AOAM530DmxPQDt6HYGgYKKgf+HV2zsq4krrHZlA5AguGSw5WqstCvK+5 yXszANHqgUEFu+IP27a29LZe1ici12dddg== X-Google-Smtp-Source: ABdhPJzjwAifZboCCMrs8b+renZjEp6OU1OnuH1u0CgmQ3apSsZqy7hME4SQrj8Js526K5KGTQdTTg== X-Received: by 2002:a7b:c8c3:: with SMTP id f3mr3283887wml.110.1611918018736; Fri, 29 Jan 2021 03:00:18 -0800 (PST) From: Peter Maydell To: qemu-devel@nongnu.org Subject: [PULL 04/46] hw: gpio: implement gpio-pwr driver for qemu reset/poweroff Date: Fri, 29 Jan 2021 10:59:30 +0000 Message-Id: <20210129110012.8660-5-peter.maydell@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20210129110012.8660-1-peter.maydell@linaro.org> References: <20210129110012.8660-1-peter.maydell@linaro.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2a00:1450:4864:20::32b; envelope-from=peter.maydell@linaro.org; helo=mail-wm1-x32b.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.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @linaro.org) Content-Type: text/plain; charset="utf-8" From: Maxim Uvarov Implement gpio-pwr driver to allow reboot and poweroff machine. This is simple driver with just 2 gpios lines. Current use case is to reboot and poweroff virt machine in secure mode. Secure pl066 gpio chip is needed for that. Signed-off-by: Maxim Uvarov Reviewed-by: Hao Wu Reviewed-by: Peter Maydell Signed-off-by: Peter Maydell --- hw/gpio/gpio_pwr.c | 70 +++++++++++++++++++++++++++++++++++++++++++++ hw/gpio/Kconfig | 3 ++ hw/gpio/meson.build | 1 + 3 files changed, 74 insertions(+) create mode 100644 hw/gpio/gpio_pwr.c diff --git a/hw/gpio/gpio_pwr.c b/hw/gpio/gpio_pwr.c new file mode 100644 index 00000000000..7714fa0dc4d --- /dev/null +++ b/hw/gpio/gpio_pwr.c @@ -0,0 +1,70 @@ +/* + * GPIO qemu power controller + * + * Copyright (c) 2020 Linaro Limited + * + * Author: Maxim Uvarov + * + * Virtual gpio driver which can be used on top of pl061 + * to reboot and shutdown qemu virtual machine. One of use + * case is gpio driver for secure world application (ARM + * Trusted Firmware.). + * + * This work is licensed under the terms of the GNU GPL, version 2 or late= r. + * See the COPYING file in the top-level directory. + * SPDX-License-Identifier: GPL-2.0-or-later + */ + +/* + * QEMU interface: + * two named input GPIO lines: + * 'reset' : when asserted, trigger system reset + * 'shutdown' : when asserted, trigger system shutdown + */ + +#include "qemu/osdep.h" +#include "hw/sysbus.h" +#include "sysemu/runstate.h" + +#define TYPE_GPIOPWR "gpio-pwr" +OBJECT_DECLARE_SIMPLE_TYPE(GPIO_PWR_State, GPIOPWR) + +struct GPIO_PWR_State { + SysBusDevice parent_obj; +}; + +static void gpio_pwr_reset(void *opaque, int n, int level) +{ + if (level) { + qemu_system_reset_request(SHUTDOWN_CAUSE_GUEST_RESET); + } +} + +static void gpio_pwr_shutdown(void *opaque, int n, int level) +{ + if (level) { + qemu_system_reset_request(SHUTDOWN_CAUSE_GUEST_SHUTDOWN); + } +} + +static void gpio_pwr_init(Object *obj) +{ + DeviceState *dev =3D DEVICE(obj); + + qdev_init_gpio_in_named(dev, gpio_pwr_reset, "reset", 1); + qdev_init_gpio_in_named(dev, gpio_pwr_shutdown, "shutdown", 1); +} + +static const TypeInfo gpio_pwr_info =3D { + .name =3D TYPE_GPIOPWR, + .parent =3D TYPE_SYS_BUS_DEVICE, + .instance_size =3D sizeof(GPIO_PWR_State), + .instance_init =3D gpio_pwr_init, +}; + +static void gpio_pwr_register_types(void) +{ + type_register_static(&gpio_pwr_info); +} + +type_init(gpio_pwr_register_types) diff --git a/hw/gpio/Kconfig b/hw/gpio/Kconfig index b6fdaa2586d..f0e7405f6e6 100644 --- a/hw/gpio/Kconfig +++ b/hw/gpio/Kconfig @@ -8,5 +8,8 @@ config PL061 config GPIO_KEY bool =20 +config GPIO_PWR + bool + config SIFIVE_GPIO bool diff --git a/hw/gpio/meson.build b/hw/gpio/meson.build index 5c0a7d7b95a..79568f00ce3 100644 --- a/hw/gpio/meson.build +++ b/hw/gpio/meson.build @@ -1,5 +1,6 @@ softmmu_ss.add(when: 'CONFIG_E500', if_true: files('mpc8xxx.c')) softmmu_ss.add(when: 'CONFIG_GPIO_KEY', if_true: files('gpio_key.c')) +softmmu_ss.add(when: 'CONFIG_GPIO_PWR', if_true: files('gpio_pwr.c')) softmmu_ss.add(when: 'CONFIG_MAX7310', if_true: files('max7310.c')) softmmu_ss.add(when: 'CONFIG_PL061', if_true: files('pl061.c')) softmmu_ss.add(when: 'CONFIG_PUV3', if_true: files('puv3_gpio.c')) --=20 2.20.1 From nobody Thu May 16 19:07:36 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1611918153; cv=none; d=zohomail.com; s=zohoarc; b=Uf2Xk18NHq7mb89Z/QtQnsyIitmaa4JCoBY+RU2zlVt8p9yn31o7K6FaMDQOgeNeQq7nwPz251k9klihIaodc63aU70q+3qfyN25qPfW/qLr595Udu3cAnEAqRXQGktBVFns6ib6laPsjM3XI41AG6VUM1EnoKQbhnHbVCH05Ds= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1611918153; h=Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=FtNu0X6aw+UWU/grRMnywbZfUCpJxNqSTCzA8QG7YAM=; b=YYAda9Yx/TvwMExXlwn5xP8T2ZWcTwoykdWoIIpJVke7bjHCucTpoFiT/T90nyyo/3ePE9ZtzdL4HXCJOUhT7QAfnsfFM8cGEVmPrxQHZD8mfJo6ze35LAIbVXXuIkqcNeKOW0g401ZgJJvU6nQHtmFrKZBl1OHLx77EnCp30R8= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1611918153884826.2515691849022; Fri, 29 Jan 2021 03:02:33 -0800 (PST) Received: from localhost ([::1]:34140 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1l5RXs-00067D-1W for importer@patchew.org; Fri, 29 Jan 2021 06:02:32 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:59510) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1l5RVu-0004Ee-Ef for qemu-devel@nongnu.org; Fri, 29 Jan 2021 06:00:33 -0500 Received: from mail-wr1-x433.google.com ([2a00:1450:4864:20::433]:36765) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1l5RVl-0006tf-TL for qemu-devel@nongnu.org; Fri, 29 Jan 2021 06:00:27 -0500 Received: by mail-wr1-x433.google.com with SMTP id 6so8389522wri.3 for ; Fri, 29 Jan 2021 03:00:20 -0800 (PST) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [81.2.115.148]) by smtp.gmail.com with ESMTPSA id w20sm9268761wmm.12.2021.01.29.03.00.18 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 29 Jan 2021 03:00:19 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:subject:date:message-id:in-reply-to:references:mime-version :content-transfer-encoding; bh=FtNu0X6aw+UWU/grRMnywbZfUCpJxNqSTCzA8QG7YAM=; b=Dptx+ifBAw46NuD/QrZp2NTZFfXLI4Z7AIPXzfM0Y4cYMTr086e6qFUJIYICFRN4v2 B7chMqUZnMI9j8cwerECp9cqRhKNffqwaAdhok5AMfIyTh5U/6i8LTEVdAPVa+h6dqOk Qrnj/wE1TZpuQMQgH/gIIjBiFhWpSsawupQer6ZNsBx2VfqZIsi7aQE/7QNoXV1hqOuk kQ3ruBVWxnn68FXp8DqA0UnS0RhjrXzJ385FTvyQkb1QjmdDOeDWZsKvnG3f18FJy7y9 v9RB9GahjNypb+ZMxSGxa91nf3BKeUUcIqcWBqUCb7L3zo1yv6XFpuojwNxl4Z52MrTN KR3Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=FtNu0X6aw+UWU/grRMnywbZfUCpJxNqSTCzA8QG7YAM=; b=PpKDdmTqJsfVjNWuU+SK355inHYLh8rkTm47EBOga3VZj1IwCN98HuNd4L/2Mg/5ic ntG6Ic3e1Wnmx4XMSG+rdZTZV/EnJc3lmCc4ZlJY1CYUahG8jknKVFsl5Uyro458RwY1 Ilq/kh1YQDAQU/uRPlQnjA2keteincVBedHlknhi2zvKK7Axd5Pfa2Np2+D4ZLSnLzV0 A9JPbxCJv6hx03qj8ryxOKqI0AUilZVp6NhQIMc9YrN5HC6XHy18dPdnDUoNwA9/TKc2 WsDXsrkhL5hl0TCx/2QbR8Ah+2o7zIc6BXEWyge+yHvqxNafk2GyIVr7bHTZ3n72uij1 1G4g== X-Gm-Message-State: AOAM532Ffxg/85zvWsrHnvyQ1YCurRjRAvhNcLnn3t3aJTz5zRAA3jUa i3QhO8QDzoUJsyMmsG9a6ADgHgVlNy21LQ== X-Google-Smtp-Source: ABdhPJyZULW57UYOfpfXU/t8xLj6Ql+6TqmWAj0S5PSTuvoaa/aFsSASNv/QSkiZr+c024fn8oZ9xw== X-Received: by 2002:adf:dfce:: with SMTP id q14mr3851141wrn.133.1611918019663; Fri, 29 Jan 2021 03:00:19 -0800 (PST) From: Peter Maydell To: qemu-devel@nongnu.org Subject: [PULL 05/46] arm-virt: refactor gpios creation Date: Fri, 29 Jan 2021 10:59:31 +0000 Message-Id: <20210129110012.8660-6-peter.maydell@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20210129110012.8660-1-peter.maydell@linaro.org> References: <20210129110012.8660-1-peter.maydell@linaro.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2a00:1450:4864:20::433; envelope-from=peter.maydell@linaro.org; helo=mail-wr1-x433.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.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @linaro.org) Content-Type: text/plain; charset="utf-8" From: Maxim Uvarov No functional change. Just refactor code to better support secure and normal world gpios. Signed-off-by: Maxim Uvarov Reviewed-by: Andrew Jones Signed-off-by: Peter Maydell --- hw/arm/virt.c | 57 ++++++++++++++++++++++++++++++++------------------- 1 file changed, 36 insertions(+), 21 deletions(-) diff --git a/hw/arm/virt.c b/hw/arm/virt.c index 86070dfd98b..5e364656037 100644 --- a/hw/arm/virt.c +++ b/hw/arm/virt.c @@ -820,17 +820,43 @@ static void virt_powerdown_req(Notifier *n, void *opa= que) } } =20 -static void create_gpio(const VirtMachineState *vms) +static void create_gpio_keys(const VirtMachineState *vms, + DeviceState *pl061_dev, + uint32_t phandle) +{ + gpio_key_dev =3D sysbus_create_simple("gpio-key", -1, + qdev_get_gpio_in(pl061_dev, 3)); + + qemu_fdt_add_subnode(vms->fdt, "/gpio-keys"); + qemu_fdt_setprop_string(vms->fdt, "/gpio-keys", "compatible", "gpio-ke= ys"); + qemu_fdt_setprop_cell(vms->fdt, "/gpio-keys", "#size-cells", 0); + qemu_fdt_setprop_cell(vms->fdt, "/gpio-keys", "#address-cells", 1); + + qemu_fdt_add_subnode(vms->fdt, "/gpio-keys/poweroff"); + qemu_fdt_setprop_string(vms->fdt, "/gpio-keys/poweroff", + "label", "GPIO Key Poweroff"); + qemu_fdt_setprop_cell(vms->fdt, "/gpio-keys/poweroff", "linux,code", + KEY_POWER); + qemu_fdt_setprop_cells(vms->fdt, "/gpio-keys/poweroff", + "gpios", phandle, 3, 0); +} + +static void create_gpio_devices(const VirtMachineState *vms, int gpio, + MemoryRegion *mem) { char *nodename; DeviceState *pl061_dev; - hwaddr base =3D vms->memmap[VIRT_GPIO].base; - hwaddr size =3D vms->memmap[VIRT_GPIO].size; - int irq =3D vms->irqmap[VIRT_GPIO]; + hwaddr base =3D vms->memmap[gpio].base; + hwaddr size =3D vms->memmap[gpio].size; + int irq =3D vms->irqmap[gpio]; const char compat[] =3D "arm,pl061\0arm,primecell"; + SysBusDevice *s; =20 - pl061_dev =3D sysbus_create_simple("pl061", base, - qdev_get_gpio_in(vms->gic, irq)); + pl061_dev =3D qdev_new("pl061"); + s =3D SYS_BUS_DEVICE(pl061_dev); + sysbus_realize_and_unref(s, &error_fatal); + memory_region_add_subregion(mem, base, sysbus_mmio_get_region(s, 0)); + sysbus_connect_irq(s, 0, qdev_get_gpio_in(vms->gic, irq)); =20 uint32_t phandle =3D qemu_fdt_alloc_phandle(vms->fdt); nodename =3D g_strdup_printf("/pl061@%" PRIx64, base); @@ -847,21 +873,10 @@ static void create_gpio(const VirtMachineState *vms) qemu_fdt_setprop_string(vms->fdt, nodename, "clock-names", "apb_pclk"); qemu_fdt_setprop_cell(vms->fdt, nodename, "phandle", phandle); =20 - gpio_key_dev =3D sysbus_create_simple("gpio-key", -1, - qdev_get_gpio_in(pl061_dev, 3)); - qemu_fdt_add_subnode(vms->fdt, "/gpio-keys"); - qemu_fdt_setprop_string(vms->fdt, "/gpio-keys", "compatible", "gpio-ke= ys"); - qemu_fdt_setprop_cell(vms->fdt, "/gpio-keys", "#size-cells", 0); - qemu_fdt_setprop_cell(vms->fdt, "/gpio-keys", "#address-cells", 1); - - qemu_fdt_add_subnode(vms->fdt, "/gpio-keys/poweroff"); - qemu_fdt_setprop_string(vms->fdt, "/gpio-keys/poweroff", - "label", "GPIO Key Poweroff"); - qemu_fdt_setprop_cell(vms->fdt, "/gpio-keys/poweroff", "linux,code", - KEY_POWER); - qemu_fdt_setprop_cells(vms->fdt, "/gpio-keys/poweroff", - "gpios", phandle, 3, 0); g_free(nodename); + + /* Child gpio devices */ + create_gpio_keys(vms, pl061_dev, phandle); } =20 static void create_virtio_devices(const VirtMachineState *vms) @@ -1990,7 +2005,7 @@ static void machvirt_init(MachineState *machine) if (has_ged && aarch64 && firmware_loaded && virt_is_acpi_enabled(vms)= ) { vms->acpi_dev =3D create_acpi_ged(vms); } else { - create_gpio(vms); + create_gpio_devices(vms, VIRT_GPIO, sysmem); } =20 /* connect powerdown request */ --=20 2.20.1 From nobody Thu May 16 19:07:36 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1611918297; cv=none; d=zohomail.com; s=zohoarc; b=AKEzOcsTEMDlxO3HWqs5b3oD8nRuyEBptyYWXRep2JL5BpsIAp1t7dI5t66evVuWq6iS55jLe8ogJa3ifBMQfTQQuTSi0yffjVhcM1LdutvOcm4WAdTxEjPyuhB5HOpk0ercu32Z6G7MJ0j/y+tTxY9FPQJR5dR5xZzeHRmTvuw= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1611918297; h=Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=IZw90pBbEJuDGmT7ybNPwx+U6Cu2tjmujRdy/bOW5DA=; b=C8DAVI/9HO0Q6LClvmmD4pyTFEey5EzHcuoBAg1EablyCC35abHAJiISwWqBW/4l+Dq1xoL9dwI3t+w4KjYjW1f9rGAzcuENYzCfhbh59Q6d7+o3jKF9CZsDtoVGV0fRAoOlnfFaRzcAQZG7d6tZGbSmCEGzN5/aj9ap0Qg8LaM= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1611918296898236.6528944347001; Fri, 29 Jan 2021 03:04:56 -0800 (PST) Received: from localhost ([::1]:42866 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1l5Ra9-0001Am-Oj for importer@patchew.org; Fri, 29 Jan 2021 06:04:53 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:59616) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1l5RW2-0004K9-07 for qemu-devel@nongnu.org; Fri, 29 Jan 2021 06:00:38 -0500 Received: from mail-wr1-x42c.google.com ([2a00:1450:4864:20::42c]:37915) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1l5RVl-0006u5-Vj for qemu-devel@nongnu.org; Fri, 29 Jan 2021 06:00:37 -0500 Received: by mail-wr1-x42c.google.com with SMTP id s7so5397142wru.5 for ; Fri, 29 Jan 2021 03:00:21 -0800 (PST) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [81.2.115.148]) by smtp.gmail.com with ESMTPSA id w20sm9268761wmm.12.2021.01.29.03.00.19 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 29 Jan 2021 03:00:20 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:subject:date:message-id:in-reply-to:references:mime-version :content-transfer-encoding; bh=IZw90pBbEJuDGmT7ybNPwx+U6Cu2tjmujRdy/bOW5DA=; b=AdCLESygSf5TVl31hugNxxzk9mIh4KMM7upRCyCi2k2o+iIBDxKXH2Gr8d1rCb6mEP QSx2ctjX/QeZ632lvvERx3uBa8q5jpzzMLF+xYNigs5YfeuLEdTt6slO546+02RZ2WMg WZyDI1H5luBOCSQF8KOQD/IsjJPzbKam6fYhsBqz17rOK4PRySNjtMj5qKXLX+EaUoBd o+6Sxl6h1g0skwO34okMN1MBLku1jbq0BY8PEQ3RWS7FuKWG+BKeO9CK24G7+yrkRaQS UPb9zn1gK1Wsr3fwWy/9Hq8na81sRTMfLJ09K45yQXmAa2o/yx4dPblYbPSzHb7R36lT phEQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=IZw90pBbEJuDGmT7ybNPwx+U6Cu2tjmujRdy/bOW5DA=; b=Y+YeT81hHbQ2OqvYMuN2M84PVF4lJLbMhotclZwvi48QKP31twJTscj2YvonhPp4Ao gDRXXJreKSncDPvpVJ05XQ6q+ZfmMDRAZSnhJT4mcniV/AjflEIEdHdk7m6eEDK1OHJh WfXihBuXNTntRx0mDITxPkkc3n4/8Ul1YOMS6VtWSJOAxdH5U9tq9MlKPJC9wlmhUFd4 IFgwoaCluVU0UURPr6uPPpJdIUl176Jj9I/xqmqfsLysxTeqrMdZ/FsocfEBG5lMDDRY D6XHh2DQM+rnirV25GZ5YEWqeHTiOVCK7lTIWAv5ZkSIaU95BuRM26VoMsaGB6685p/g KW0w== X-Gm-Message-State: AOAM532z8/J9UeJFtHoLXJKe6RqEYjT6lQGzbJRkoXt4kMw7866Dsp4R iYvpgX1WIWkjKjVJ7eiutU9uSl9t2wNMuQ== X-Google-Smtp-Source: ABdhPJwCbVq5n5OGqGsmAJsV7lolOHW3LS1zZxSHw2IfA7gcMVm4juI0wg9/kz9l4pExZmCJW34wLg== X-Received: by 2002:adf:ee0d:: with SMTP id y13mr3955997wrn.228.1611918020591; Fri, 29 Jan 2021 03:00:20 -0800 (PST) From: Peter Maydell To: qemu-devel@nongnu.org Subject: [PULL 06/46] arm-virt: add secure pl061 for reset/power down Date: Fri, 29 Jan 2021 10:59:32 +0000 Message-Id: <20210129110012.8660-7-peter.maydell@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20210129110012.8660-1-peter.maydell@linaro.org> References: <20210129110012.8660-1-peter.maydell@linaro.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2a00:1450:4864:20::42c; envelope-from=peter.maydell@linaro.org; helo=mail-wr1-x42c.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.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @linaro.org) Content-Type: text/plain; charset="utf-8" From: Maxim Uvarov Add secure pl061 for reset/power down machine from the secure world (Arm Trusted Firmware). Connect it with gpio-pwr driver. Signed-off-by: Maxim Uvarov Reviewed-by: Andrew Jones [PMM: Added mention of the new device to the documentation] Signed-off-by: Peter Maydell --- docs/system/arm/virt.rst | 2 ++ include/hw/arm/virt.h | 2 ++ hw/arm/virt.c | 56 +++++++++++++++++++++++++++++++++++++++- hw/arm/Kconfig | 1 + 4 files changed, 60 insertions(+), 1 deletion(-) diff --git a/docs/system/arm/virt.rst b/docs/system/arm/virt.rst index 32dc5eb22ee..27652adfae1 100644 --- a/docs/system/arm/virt.rst +++ b/docs/system/arm/virt.rst @@ -43,6 +43,8 @@ The virt board supports: - Secure-World-only devices if the CPU has TrustZone: =20 - A second PL011 UART + - A second PL061 GPIO controller, with GPIO lines for triggering + a system reset or system poweroff - A secure flash memory - 16MB of secure RAM =20 diff --git a/include/hw/arm/virt.h b/include/hw/arm/virt.h index e4a2d216420..36fcb296415 100644 --- a/include/hw/arm/virt.h +++ b/include/hw/arm/virt.h @@ -81,6 +81,7 @@ enum { VIRT_GPIO, VIRT_SECURE_UART, VIRT_SECURE_MEM, + VIRT_SECURE_GPIO, VIRT_PCDIMM_ACPI, VIRT_ACPI_GED, VIRT_NVDIMM_ACPI, @@ -127,6 +128,7 @@ struct VirtMachineClass { bool kvm_no_adjvtime; bool no_kvm_steal_time; bool acpi_expose_flash; + bool no_secure_gpio; }; =20 struct VirtMachineState { diff --git a/hw/arm/virt.c b/hw/arm/virt.c index 5e364656037..399da734548 100644 --- a/hw/arm/virt.c +++ b/hw/arm/virt.c @@ -153,6 +153,7 @@ static const MemMapEntry base_memmap[] =3D { [VIRT_ACPI_GED] =3D { 0x09080000, ACPI_GED_EVT_SEL_LEN }, [VIRT_NVDIMM_ACPI] =3D { 0x09090000, NVDIMM_ACPI_IO_LEN}, [VIRT_PVTIME] =3D { 0x090a0000, 0x00010000 }, + [VIRT_SECURE_GPIO] =3D { 0x090b0000, 0x00001000 }, [VIRT_MMIO] =3D { 0x0a000000, 0x00000200 }, /* ...repeating for a total of NUM_VIRTIO_TRANSPORTS, each of that siz= e */ [VIRT_PLATFORM_BUS] =3D { 0x0c000000, 0x02000000 }, @@ -841,6 +842,43 @@ static void create_gpio_keys(const VirtMachineState *v= ms, "gpios", phandle, 3, 0); } =20 +#define SECURE_GPIO_POWEROFF 0 +#define SECURE_GPIO_RESET 1 + +static void create_secure_gpio_pwr(const VirtMachineState *vms, + DeviceState *pl061_dev, + uint32_t phandle) +{ + DeviceState *gpio_pwr_dev; + + /* gpio-pwr */ + gpio_pwr_dev =3D sysbus_create_simple("gpio-pwr", -1, NULL); + + /* connect secure pl061 to gpio-pwr */ + qdev_connect_gpio_out(pl061_dev, SECURE_GPIO_RESET, + qdev_get_gpio_in_named(gpio_pwr_dev, "reset", 0)= ); + qdev_connect_gpio_out(pl061_dev, SECURE_GPIO_POWEROFF, + qdev_get_gpio_in_named(gpio_pwr_dev, "shutdown",= 0)); + + qemu_fdt_add_subnode(vms->fdt, "/gpio-poweroff"); + qemu_fdt_setprop_string(vms->fdt, "/gpio-poweroff", "compatible", + "gpio-poweroff"); + qemu_fdt_setprop_cells(vms->fdt, "/gpio-poweroff", + "gpios", phandle, SECURE_GPIO_POWEROFF, 0); + qemu_fdt_setprop_string(vms->fdt, "/gpio-poweroff", "status", "disable= d"); + qemu_fdt_setprop_string(vms->fdt, "/gpio-poweroff", "secure-status", + "okay"); + + qemu_fdt_add_subnode(vms->fdt, "/gpio-restart"); + qemu_fdt_setprop_string(vms->fdt, "/gpio-restart", "compatible", + "gpio-restart"); + qemu_fdt_setprop_cells(vms->fdt, "/gpio-restart", + "gpios", phandle, SECURE_GPIO_RESET, 0); + qemu_fdt_setprop_string(vms->fdt, "/gpio-restart", "status", "disabled= "); + qemu_fdt_setprop_string(vms->fdt, "/gpio-restart", "secure-status", + "okay"); +} + static void create_gpio_devices(const VirtMachineState *vms, int gpio, MemoryRegion *mem) { @@ -873,10 +911,19 @@ static void create_gpio_devices(const VirtMachineStat= e *vms, int gpio, qemu_fdt_setprop_string(vms->fdt, nodename, "clock-names", "apb_pclk"); qemu_fdt_setprop_cell(vms->fdt, nodename, "phandle", phandle); =20 + if (gpio !=3D VIRT_GPIO) { + /* Mark as not usable by the normal world */ + qemu_fdt_setprop_string(vms->fdt, nodename, "status", "disabled"); + qemu_fdt_setprop_string(vms->fdt, nodename, "secure-status", "okay= "); + } g_free(nodename); =20 /* Child gpio devices */ - create_gpio_keys(vms, pl061_dev, phandle); + if (gpio =3D=3D VIRT_GPIO) { + create_gpio_keys(vms, pl061_dev, phandle); + } else { + create_secure_gpio_pwr(vms, pl061_dev, phandle); + } } =20 static void create_virtio_devices(const VirtMachineState *vms) @@ -2008,6 +2055,10 @@ static void machvirt_init(MachineState *machine) create_gpio_devices(vms, VIRT_GPIO, sysmem); } =20 + if (vms->secure && !vmc->no_secure_gpio) { + create_gpio_devices(vms, VIRT_SECURE_GPIO, secure_sysmem); + } + /* connect powerdown request */ vms->powerdown_notifier.notify =3D virt_powerdown_req; qemu_register_powerdown_notifier(&vms->powerdown_notifier); @@ -2623,8 +2674,11 @@ DEFINE_VIRT_MACHINE_AS_LATEST(6, 0) =20 static void virt_machine_5_2_options(MachineClass *mc) { + VirtMachineClass *vmc =3D VIRT_MACHINE_CLASS(OBJECT_CLASS(mc)); + virt_machine_6_0_options(mc); compat_props_add(mc->compat_props, hw_compat_5_2, hw_compat_5_2_len); + vmc->no_secure_gpio =3D true; } DEFINE_VIRT_MACHINE(5, 2) =20 diff --git a/hw/arm/Kconfig b/hw/arm/Kconfig index 0a242e4c5d8..13cc42dcc84 100644 --- a/hw/arm/Kconfig +++ b/hw/arm/Kconfig @@ -17,6 +17,7 @@ config ARM_VIRT select PL011 # UART select PL031 # RTC select PL061 # GPIO + select GPIO_PWR select PLATFORM_BUS select SMBIOS select VIRTIO_MMIO --=20 2.20.1 From nobody Thu May 16 19:07:36 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1611918537; cv=none; d=zohomail.com; s=zohoarc; b=Z7JqREkGTBQ1ifTmMlH2BE4Pqv07QIMGildhmeNO1bR1GlmScHJSXp3S/bQvmHEY606NW9TYJqR4zUBxs+Z9ohP9FV2IukiRyIXoFTGiSaULqDugmsALxciDzzfsvzGWnErTqnxaqapoXBGvs3vw/lX87XRLkMHuorNiJ6baQUU= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1611918537; h=Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=TPZILYkgh6hHHCNCFPKdewpdFM5U2Lja1SNGzqSj66g=; b=IIHfFOd2kOPWhvKl3wJOIXt6TtgY/RHJkIQWvH/Bkv+R4Z0okBScHiVaR7Qaoz8G15GvA+rQtUU8h/Ntud4PBlUKRXZ/nuKPiqQ2Gl7DJqJi+sVt0Zg0njWYITgOLcrdCXHYEb5Yf6aZzIwQ4xheAZOqaiGt3e+/wYilHMnlJ+A= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1611918537476795.017081552122; Fri, 29 Jan 2021 03:08:57 -0800 (PST) Received: from localhost ([::1]:59920 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1l5Re3-00084Q-A6 for importer@patchew.org; Fri, 29 Jan 2021 06:08:55 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:59638) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1l5RW3-0004NN-5c for qemu-devel@nongnu.org; Fri, 29 Jan 2021 06:00:39 -0500 Received: from mail-wm1-x32c.google.com ([2a00:1450:4864:20::32c]:34319) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1l5RVn-0006uP-PS for qemu-devel@nongnu.org; Fri, 29 Jan 2021 06:00:38 -0500 Received: by mail-wm1-x32c.google.com with SMTP id o10so6794960wmc.1 for ; Fri, 29 Jan 2021 03:00:22 -0800 (PST) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [81.2.115.148]) by smtp.gmail.com with ESMTPSA id w20sm9268761wmm.12.2021.01.29.03.00.20 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 29 Jan 2021 03:00:20 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:subject:date:message-id:in-reply-to:references:mime-version :content-transfer-encoding; bh=TPZILYkgh6hHHCNCFPKdewpdFM5U2Lja1SNGzqSj66g=; b=NTj2LZVunRd2c32EUbiQZgWQ42M6nvRxLlXU/HDTtZJWWxc5gLXfXwDjd06AAiTYVU SfYZqmlbIdY5wth+CeklBS5ryOfOIf9Di8pxVsF71Eopk6EpJfARHfI/BhW3upLixWmO MFtJfFmAuMeAJemD6ctMw2YSmqBW23V5X+ur/hSi4vogV0V2SIEw87bTNKeVuELc2dpj XAFzFCxDYCqyIdWFw0Uw8SDTTUONeCTlqzF0UVz/Q9DREftiuDdcHTzNDI27qK5P+ged UUAyTXIvDy0MuSzimSQOABSyHSjsnjuzo8C/jSi6YWOyTdkyt5ZO4s2W9RGEaf0fB7D3 F3gw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=TPZILYkgh6hHHCNCFPKdewpdFM5U2Lja1SNGzqSj66g=; b=YZTObGZvZ1faugeLxEF9tyw17SGR5/O7VSWpGOmir87WdRBZIHnLPb+719SHShOCwG GGmg4U8p/ZhERa2rOsadxOIaVXlrGQplu8iSAxgIIpxoPtGAqoqRbaZ8OCALAAhyWMOI TYhbv77+tBl5bmObvxzg9lNWh2glBPZwzJymmT/KA2GpR7t7iGuLnObUnQ4noTtfktGj HxZi/d6cxBvTnyPTi2weq7D639xGaEIkQEaclpGvR2NE9Ic/FyW3E5f+xRw2r/eEVyVW O7fYBhmE9pu1hTykGlokOUxSCQJTBy3XyGc9OsB+3YqQXQRRDCTKoImmHH21yGUKMoeS pzfw== X-Gm-Message-State: AOAM530tds0/ndDHbtQ4Cg1CMEKHtPk7XXItkw/vJf3DsDuhcU23DoOu OcIsASn4cqja8jOUK6Z5pMVcD8g6JDQheQ== X-Google-Smtp-Source: ABdhPJxEo1ngYSt23R/bZISdTckFRbCylpLKnKCtMmjQfXiT1mx6Qwjqv5yv6T8Sk8Eo7UINEmHvEA== X-Received: by 2002:a05:600c:35d6:: with SMTP id r22mr3280098wmq.44.1611918021527; Fri, 29 Jan 2021 03:00:21 -0800 (PST) From: Peter Maydell To: qemu-devel@nongnu.org Subject: [PULL 07/46] hw/misc: Fix arith overflow in NPCM7XX PWM module Date: Fri, 29 Jan 2021 10:59:33 +0000 Message-Id: <20210129110012.8660-8-peter.maydell@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20210129110012.8660-1-peter.maydell@linaro.org> References: <20210129110012.8660-1-peter.maydell@linaro.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2a00:1450:4864:20::32c; envelope-from=peter.maydell@linaro.org; helo=mail-wm1-x32c.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.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @linaro.org) Content-Type: text/plain; charset="utf-8" From: Hao Wu Fix potential overflow problem when calculating pwm_duty. 1. Ensure p->cmr and p->cnr to be from [0,65535], according to the hardware specification. 2. Changed duty to uint32_t. However, since MAX_DUTY * (p->cmr+1) can excceed UINT32_MAX, we convert them to uint64_t in computation and converted them back to uint32_t. (duty is guaranteed to be <=3D MAX_DUTY so it won't overflow.) Fixes: CID 1442342 Suggested-by: Peter Maydell Reviewed-by: Doug Evans Signed-off-by: Hao Wu Message-id: 20210127011142.2122790-1-wuhaotsh@google.com Reviewed-by: Peter Maydell Signed-off-by: Peter Maydell --- hw/misc/npcm7xx_pwm.c | 23 +++++++++++++++++++---- tests/qtest/npcm7xx_pwm-test.c | 4 ++-- 2 files changed, 21 insertions(+), 6 deletions(-) diff --git a/hw/misc/npcm7xx_pwm.c b/hw/misc/npcm7xx_pwm.c index e99e3cc7ef3..dabcb6c0f95 100644 --- a/hw/misc/npcm7xx_pwm.c +++ b/hw/misc/npcm7xx_pwm.c @@ -58,6 +58,9 @@ REG32(NPCM7XX_PWM_PWDR3, 0x50); #define NPCM7XX_CH_INV BIT(2) #define NPCM7XX_CH_MOD BIT(3) =20 +#define NPCM7XX_MAX_CMR 65535 +#define NPCM7XX_MAX_CNR 65535 + /* Offset of each PWM channel's prescaler in the PPR register. */ static const int npcm7xx_ppr_base[] =3D { 0, 0, 8, 8 }; /* Offset of each PWM channel's clock selector in the CSR register. */ @@ -96,7 +99,7 @@ static uint32_t npcm7xx_pwm_calculate_freq(NPCM7xxPWM *p) =20 static uint32_t npcm7xx_pwm_calculate_duty(NPCM7xxPWM *p) { - uint64_t duty; + uint32_t duty; =20 if (p->running) { if (p->cnr =3D=3D 0) { @@ -104,7 +107,7 @@ static uint32_t npcm7xx_pwm_calculate_duty(NPCM7xxPWM *= p) } else if (p->cmr >=3D p->cnr) { duty =3D NPCM7XX_PWM_MAX_DUTY; } else { - duty =3D NPCM7XX_PWM_MAX_DUTY * (p->cmr + 1) / (p->cnr + 1); + duty =3D (uint64_t)NPCM7XX_PWM_MAX_DUTY * (p->cmr + 1) / (p->c= nr + 1); } } else { duty =3D 0; @@ -357,7 +360,13 @@ static void npcm7xx_pwm_write(void *opaque, hwaddr off= set, case A_NPCM7XX_PWM_CNR2: case A_NPCM7XX_PWM_CNR3: p =3D &s->pwm[npcm7xx_cnr_index(offset)]; - p->cnr =3D value; + if (value > NPCM7XX_MAX_CNR) { + qemu_log_mask(LOG_GUEST_ERROR, + "%s: invalid cnr value: %u", __func__, value); + p->cnr =3D NPCM7XX_MAX_CNR; + } else { + p->cnr =3D value; + } npcm7xx_pwm_update_output(p); break; =20 @@ -366,7 +375,13 @@ static void npcm7xx_pwm_write(void *opaque, hwaddr off= set, case A_NPCM7XX_PWM_CMR2: case A_NPCM7XX_PWM_CMR3: p =3D &s->pwm[npcm7xx_cmr_index(offset)]; - p->cmr =3D value; + if (value > NPCM7XX_MAX_CMR) { + qemu_log_mask(LOG_GUEST_ERROR, + "%s: invalid cmr value: %u", __func__, value); + p->cmr =3D NPCM7XX_MAX_CMR; + } else { + p->cmr =3D value; + } npcm7xx_pwm_update_output(p); break; =20 diff --git a/tests/qtest/npcm7xx_pwm-test.c b/tests/qtest/npcm7xx_pwm-test.c index 63557d2c061..3d82654b81a 100644 --- a/tests/qtest/npcm7xx_pwm-test.c +++ b/tests/qtest/npcm7xx_pwm-test.c @@ -272,7 +272,7 @@ static uint64_t pwm_compute_freq(QTestState *qts, uint3= 2_t ppr, uint32_t csr, =20 static uint64_t pwm_compute_duty(uint32_t cnr, uint32_t cmr, bool inverted) { - uint64_t duty; + uint32_t duty; =20 if (cnr =3D=3D 0) { /* PWM is stopped. */ @@ -280,7 +280,7 @@ static uint64_t pwm_compute_duty(uint32_t cnr, uint32_t= cmr, bool inverted) } else if (cmr >=3D cnr) { duty =3D MAX_DUTY; } else { - duty =3D MAX_DUTY * (cmr + 1) / (cnr + 1); + duty =3D (uint64_t)MAX_DUTY * (cmr + 1) / (cnr + 1); } =20 if (inverted) { --=20 2.20.1 From nobody Thu May 16 19:07:36 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1611918157; cv=none; d=zohomail.com; s=zohoarc; b=YA9+kPtrt5HB89ordrh5ztWOXvFm1nAJgfhbHPKvlf3tyPsr/QOjJdxG5Pm8cdqhINbSs1S/D2z4GFops2+GvhpZegZ+mGaoSSF6a6uZeZPKgDiXuWBlcDDUiCqHlFY5q9F8IAUNxju06MCSg7iKHRQj0zWLM51Nd8rbykJBN/w= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1611918157; h=Content-Type:Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=qewTpRFCmZV4l2YIPf8U3raTgpS0uedHR3JcStZB1zg=; b=SF/SGPsEl92B1YX1C9IuKJcpK57mJk7JMiUQnixpRciDdpKannruDtl2G+qQbGQiL2JxaOoTEWURbYRmuuQJSLSgJZ1dbjEjeaC7DvGbqDLSz+kjhHAyS3WrGWUBVAnQArK074ZF1D+Ui7qLl/5j9L6KKMXs3ke0wKv9oyZBCI4= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1611918157435367.23961349479976; Fri, 29 Jan 2021 03:02:37 -0800 (PST) Received: from localhost ([::1]:34564 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1l5RXw-0006HP-2Z for importer@patchew.org; Fri, 29 Jan 2021 06:02:36 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:59644) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1l5RW3-0004OA-Bp for qemu-devel@nongnu.org; Fri, 29 Jan 2021 06:00:39 -0500 Received: from mail-wr1-x436.google.com ([2a00:1450:4864:20::436]:34988) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1l5RVn-0006vJ-PU for qemu-devel@nongnu.org; Fri, 29 Jan 2021 06:00:39 -0500 Received: by mail-wr1-x436.google.com with SMTP id l12so8404730wry.2 for ; Fri, 29 Jan 2021 03:00:23 -0800 (PST) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [81.2.115.148]) by smtp.gmail.com with ESMTPSA id w20sm9268761wmm.12.2021.01.29.03.00.21 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 29 Jan 2021 03:00:21 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:subject:date:message-id:in-reply-to:references:mime-version :content-transfer-encoding; bh=qewTpRFCmZV4l2YIPf8U3raTgpS0uedHR3JcStZB1zg=; b=m4OEAPh+PmUJw4V317r+HyCwpjlCQeFSWh69lU7OwcLKovBFzONgMpHZxNDZcRkKoY 8yQdDyn6LvBx4XN50zs+t75b5MaQMXoKw8Ode0+/ydgiVXxMu8mfz+R73wNF8zf3ax15 Ernuvkf56ZmrSZqtQ8vQeAFocz7vrViIsD20q7Ow1B6yGQ9/xAJi6oQG+VKnnK5a5dVf l3h3BP5Fj58Y8Y1mjnZc+vQ0uCPVDEibEYNsS0uWHyh08FXsMPhzFH1Uq2zR/WVubCM5 lo38HbcGbfLTQGXUpUqgCTupCQGooIVZgnsnP+tpFwThQB9Noeby+uJyde1XFoqH2yyZ 2pUw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=qewTpRFCmZV4l2YIPf8U3raTgpS0uedHR3JcStZB1zg=; b=UFj100e8Vr+4th5GJyMSViJn5obgrvU4cxloKpxyXwigA9b8dpkA1pI1g8TXZ8yeOf I85Bo8o02ZChCTCE1cHefwhB1bIKA9xhBqlN+i5akEpwQgd482GXxru/dOPHchDhyu08 kZ2Szkqxpun8KkM2nPeb5mkPg+3RKo49vdX6g/hqD2qGsJhCqPjMz/l9lSRyQcPPvG31 3ABIjk4z2GQKfh9XzeM2MjhtXqLmaeTBVmroC8vjJX0M1flrYNVUec8JXiVUDc6Qx8pj ZEgryHWhU/SxyYXRuyyw6bdQw7HPdsiLAhZWWPbCf90eqTrw3aRzuXwsna1oo2CBGafB dOqg== X-Gm-Message-State: AOAM5304FcmMxZ9M+MBuR7zv7P2xKQBw6qdgRmRLpZNsEhACqNHGA0i4 7lQ4tGC9FIyxLkRDB9NrYohNZ0q26CLd1Q== X-Google-Smtp-Source: ABdhPJw9qB/5nUEyje3/M/RAIhF/Jy7WjAVRb9d47chVts8jXUeGl90TQ9ir6+Yck8Px73JHND6IhA== X-Received: by 2002:adf:c14d:: with SMTP id w13mr3781771wre.383.1611918022420; Fri, 29 Jan 2021 03:00:22 -0800 (PST) From: Peter Maydell To: qemu-devel@nongnu.org Subject: [PULL 08/46] target/arm: Replace magic value by MMU_DATA_LOAD definition Date: Fri, 29 Jan 2021 10:59:34 +0000 Message-Id: <20210129110012.8660-9-peter.maydell@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20210129110012.8660-1-peter.maydell@linaro.org> References: <20210129110012.8660-1-peter.maydell@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2a00:1450:4864:20::436; envelope-from=peter.maydell@linaro.org; helo=mail-wr1-x436.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.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @linaro.org) From: Philippe Mathieu-Daud=C3=A9 cpu_get_phys_page_debug() uses 'DATA LOAD' MMU access type. Signed-off-by: Philippe Mathieu-Daud=C3=A9 Message-id: 20210127232822.3530782-1-f4bug@amsat.org Reviewed-by: Peter Maydell Signed-off-by: Peter Maydell --- target/arm/helper.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/target/arm/helper.c b/target/arm/helper.c index 677a4aa79e7..47e266d7e64 100644 --- a/target/arm/helper.c +++ b/target/arm/helper.c @@ -12418,7 +12418,7 @@ hwaddr arm_cpu_get_phys_page_attrs_debug(CPUState *= cs, vaddr addr, =20 *attrs =3D (MemTxAttrs) {}; =20 - ret =3D get_phys_addr(env, addr, 0, mmu_idx, &phys_addr, + ret =3D get_phys_addr(env, addr, MMU_DATA_LOAD, mmu_idx, &phys_addr, attrs, &prot, &page_size, &fi, &cacheattrs); =20 if (ret) { --=20 2.20.1 From nobody Thu May 16 19:07:36 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1611918298; cv=none; d=zohomail.com; s=zohoarc; b=H3eqBJ+fwPTT2wSnCIHeTAClfCOILqTJ6nHCOdQ/fxH/NPYY+Ac2XoykBTZ+KM3UZsS2wd5LhvJoOWSh7I7glIRwc9M4+UPunXS3HGSpm6VA8sqdoOqah4t0nIsNmTSm0YLmmx3aQ2TBefoE3DfUs7EPRFUJB1X2RF8xdhKIoZM= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1611918298; h=Content-Type:Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=iW8Ts76zOzAuSJ0IzcTQOSJYua+KNxe9xoQ6aMzjrVY=; b=OFiS4k95LIKEBZRodluWOnT/NcJvEsPNVcX82Ku88VmvBBruLha/enG+kSOdaXOiUR+Jd5n4TdUouAaF9tjz1mgBgZIjfa0+bkdTcvpnqL1t4ZeAMecumMcmX0OZ6x5N1ZbCPGAmQyVB6o1mjVr3htP8UJ0IpwDPyaMqk6fuOhQ= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1611918298272917.8713277135914; Fri, 29 Jan 2021 03:04:58 -0800 (PST) Received: from localhost ([::1]:43088 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1l5RaC-0001Gj-7a for importer@patchew.org; Fri, 29 Jan 2021 06:04:56 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:59652) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1l5RW3-0004Pc-Un for qemu-devel@nongnu.org; Fri, 29 Jan 2021 06:00:39 -0500 Received: from mail-wr1-x42c.google.com ([2a00:1450:4864:20::42c]:43311) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1l5RVp-0006wr-KE for qemu-devel@nongnu.org; Fri, 29 Jan 2021 06:00:39 -0500 Received: by mail-wr1-x42c.google.com with SMTP id z6so8339079wrq.10 for ; Fri, 29 Jan 2021 03:00:24 -0800 (PST) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [81.2.115.148]) by smtp.gmail.com with ESMTPSA id w20sm9268761wmm.12.2021.01.29.03.00.22 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 29 Jan 2021 03:00:22 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:subject:date:message-id:in-reply-to:references:mime-version :content-transfer-encoding; bh=iW8Ts76zOzAuSJ0IzcTQOSJYua+KNxe9xoQ6aMzjrVY=; b=KT5BrKcpDPmtWwQ/4kxdCsBhjTFwYfwOtl+N3Xax/It+IYSnTLT0AZU/W2Zr6StYdI j8UGai7pw4veE8eJgftB4Xbr3tWujxzvfDCAXaFG9mXQm0Jc2YdVi9zVAn5iJvJD8OWS FiS+HGeeMf2iiW6EfmfwdwHkoasozq5aFDBVC7mcDc+Yxs4Aqcw+3IwI+6FPdotJtjxS 8EPup0VekGQQYpceSQP/krTfBwl0Zqrm90RBoLayeGQZCU1hOuBi5hcU8IocXDk8ND7D hMNl5/Y16L3K5tYrFRmx+iA7IeKMSG3M1j+y3pys00CNw4GAD40hEaezWnwNaUcrrSnG frtg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=iW8Ts76zOzAuSJ0IzcTQOSJYua+KNxe9xoQ6aMzjrVY=; b=dpnYV55CtSjL8bz3CgKlnYcY8mzYYTU3FVKu4lmTJJ1XmN6lI+42ySbl7okz58w+Vw GffpxCU1nxPhiyRAPu/TQVoPILJBbTuL39J1FPRCAPRh5xxQCN3RrkYCjpps3uzIejEE Zde2y8JlcNdeIx+6Xwqnq1Y6D+5HfjmN82BTFWu0fhcy1jOSH3DV4ZQhWcaAPYI/cP9x HsUu7fYQRunGScMnwlaUFFV4hm+PtxEB14zyRxF7EaYJni3ZKa9tcAtqdpC+MFWmCCeA 8T3LyVr+JCV6PPpHXTpTDZsydPQGCtilK2j8lRTgTaz5iPrJ9Co56Ajp1qGhATGvWq8A ljbA== X-Gm-Message-State: AOAM530gVMCPDesYAwJlIYnIxt5nEb8didcGdkIgRb1HF5lAYuzbkewl kRuddxScTmr4vH2lPuv2kYjQ1xXALBz2KQ== X-Google-Smtp-Source: ABdhPJw7e35JalF6YccQ9bWlfqwJn4g/zFlmXRRzg4n2HPSCS5Y5+Sm9+7MnrP+fj18m79g0ss81FQ== X-Received: by 2002:a5d:6189:: with SMTP id j9mr3852673wru.256.1611918023539; Fri, 29 Jan 2021 03:00:23 -0800 (PST) From: Peter Maydell To: qemu-devel@nongnu.org Subject: [PULL 09/46] configure: Move preadv check to meson.build Date: Fri, 29 Jan 2021 10:59:35 +0000 Message-Id: <20210129110012.8660-10-peter.maydell@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20210129110012.8660-1-peter.maydell@linaro.org> References: <20210129110012.8660-1-peter.maydell@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2a00:1450:4864:20::42c; envelope-from=peter.maydell@linaro.org; helo=mail-wr1-x42c.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.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @linaro.org) Move the preadv availability check to meson.build. This is what we want to be doing for host-OS-feature-checks anyway, but it also fixes a problem with building for macOS with the most recent XCode SDK on a Catalina host. On that configuration, 'preadv()' is provided as a weak symbol, so that programs can be built with optional support for it and make a runtime availability check to see whether the preadv() they have is a working one or one which they must not call because it will runtime-assert. QEMU's configure test passes (unless you're building with --enable-werror) because the test program using preadv() compiles, but then QEMU crashes at runtime when preadv() is called, with errors like: dyld: lazy symbol binding failed: Symbol not found: _preadv Referenced from: /Users/pm215/src/qemu/./build/x86/tests/test-replicati= on Expected in: /usr/lib/libSystem.B.dylib dyld: Symbol not found: _preadv Referenced from: /Users/pm215/src/qemu/./build/x86/tests/test-replicati= on Expected in: /usr/lib/libSystem.B.dylib Meson's own function availability check has a special case for macOS which adds '-Wl,-no_weak_imports' to the compiler flags, which forces the test to require the real function, not the macOS-version-too-old stub. So this commit fixes the bug where macOS builds on Catalina currently require --disable-werror. Signed-off-by: Peter Maydell Acked-by: Paolo Bonzini Reviewed-by: Philippe Mathieu-Daud=C3=A9 Message-id: 20210126155846.17109-1-peter.maydell@linaro.org --- configure | 16 ---------------- meson.build | 4 +++- 2 files changed, 3 insertions(+), 17 deletions(-) diff --git a/configure b/configure index 87de49e2c21..8549c7b5ebe 100755 --- a/configure +++ b/configure @@ -3531,19 +3531,6 @@ if compile_prog "" "" ; then iovec=3Dyes fi =20 -########################################## -# preadv probe -cat > $TMPC < -#include -#include -int main(void) { return preadv(0, 0, 0, 0); } -EOF -preadv=3Dno -if compile_prog "" "" ; then - preadv=3Dyes -fi - ########################################## # fdt probe =20 @@ -5748,9 +5735,6 @@ fi if test "$iovec" =3D "yes" ; then echo "CONFIG_IOVEC=3Dy" >> $config_host_mak fi -if test "$preadv" =3D "yes" ; then - echo "CONFIG_PREADV=3Dy" >> $config_host_mak -fi if test "$membarrier" =3D "yes" ; then echo "CONFIG_MEMBARRIER=3Dy" >> $config_host_mak fi diff --git a/meson.build b/meson.build index a58c6f67854..27c31caa2d1 100644 --- a/meson.build +++ b/meson.build @@ -1128,6 +1128,8 @@ config_host_data.set('HAVE_PTY_H', cc.has_header('pty= .h')) config_host_data.set('HAVE_SYS_IOCCOM_H', cc.has_header('sys/ioccom.h')) config_host_data.set('HAVE_SYS_KCOV_H', cc.has_header('sys/kcov.h')) =20 +config_host_data.set('CONFIG_PREADV', cc.has_function('preadv', prefix: '#= include ')) + ignored =3D ['CONFIG_QEMU_INTERP_PREFIX'] # actually per-target arrays =3D ['CONFIG_AUDIO_DRIVERS', 'CONFIG_BDRV_RW_WHITELIST', 'CONFIG_BD= RV_RO_WHITELIST'] strings =3D ['HOST_DSOSUF', 'CONFIG_IASL'] @@ -2414,7 +2416,7 @@ summary_info +=3D {'PIE': get_option('b= _pie')} summary_info +=3D {'static build': config_host.has_key('CONFIG_STATIC= ')} summary_info +=3D {'malloc trim support': has_malloc_trim} summary_info +=3D {'membarrier': config_host.has_key('CONFIG_MEMBAR= RIER')} -summary_info +=3D {'preadv support': config_host.has_key('CONFIG_PREADV= ')} +summary_info +=3D {'preadv support': config_host_data.get('CONFIG_PREAD= V')} summary_info +=3D {'fdatasync': config_host.has_key('CONFIG_FDATAS= YNC')} summary_info +=3D {'madvise': config_host.has_key('CONFIG_MADVIS= E')} summary_info +=3D {'posix_madvise': config_host.has_key('CONFIG_POSIX_= MADVISE')} --=20 2.20.1 From nobody Thu May 16 19:07:36 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1611918821; cv=none; d=zohomail.com; s=zohoarc; b=i+qXKdjmidEZkQuJjfFsy1jC2AsXDavL/oWJWFJHrHWXny1KUj7eHPj0IqhqW0QXOG/XxFMk9L9spdKw0St315myJdrLq1+FZBP5yE36F8Jv4Ii/nTF2OU8fiWF13mK+9urjOkWyHhNNg2fu/CRdsDDdPHhn/FUczpx4mBcaePk= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1611918821; h=Content-Type:Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=dIU1+pzOEqhA9i3KvQhwnkFnGoZA70Rr7h7wCQWNREk=; b=KKYzGbxu1XUpIzyZJns+m8+zCT2PIR2KYxupIJNlCoLidyFuoZDnnYjYOMsxvNpvPYIYLuWc22RxWf+AculQ6Jd8PlziewGiAW3WQNOYYyTnhhtwsb9lzDZuyD59UDGKfdRWuU4SW3qnHAnGXbhSxGwPpYYBrq1nFlbEQl9pEXU= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1611918821557429.95306134937493; Fri, 29 Jan 2021 03:13:41 -0800 (PST) Received: from localhost ([::1]:48638 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1l5Rid-0006bu-OI for importer@patchew.org; Fri, 29 Jan 2021 06:13:40 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:59676) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1l5RW4-0004Qn-LU for qemu-devel@nongnu.org; Fri, 29 Jan 2021 06:00:40 -0500 Received: from mail-wr1-x42d.google.com ([2a00:1450:4864:20::42d]:44965) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1l5RVp-0006yJ-L8 for qemu-devel@nongnu.org; Fri, 29 Jan 2021 06:00:40 -0500 Received: by mail-wr1-x42d.google.com with SMTP id d16so8349937wro.11 for ; Fri, 29 Jan 2021 03:00:25 -0800 (PST) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [81.2.115.148]) by smtp.gmail.com with ESMTPSA id w20sm9268761wmm.12.2021.01.29.03.00.23 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 29 Jan 2021 03:00:23 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:subject:date:message-id:in-reply-to:references:mime-version :content-transfer-encoding; bh=dIU1+pzOEqhA9i3KvQhwnkFnGoZA70Rr7h7wCQWNREk=; b=DtPju1WdLMuqO7D2fp8Vw5UzXRW8UyLMvDo009PBni6LdyIe7OMNLm1fy5dxpzH3ST Ul9RJ+G2iJUsDOiQnI+jg8tqISGCLAor8JEInbaHMDHgfmrK+m3IVJLzlT7dqG0Hpb3g b/LBORD3edeBOJ64nyYAFVmqOAL3f4Kr2poaWo7J8w2/KXH2H0z1s/5nFAQRkZWBxB/i RRhgSYX6gdLi/EiZV4YNjmkuQ6c2GKg3FYcI34xsnEIcBoMFBjDPgmUrxiNvFiGiGjQz MIk20mr4S2bZY6H3YlLyMVAcmZbIJaxNWOlJEigJWIb2iAkbv1xj5l9Ew7L1Eh6oVLph oFVQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=dIU1+pzOEqhA9i3KvQhwnkFnGoZA70Rr7h7wCQWNREk=; b=tCsAc9QklPJbV1MYMs3InXcF7KnCA40WVHRcrpOu5GFX9EbfnKdRas0RsYTZU/GJpz 60xtJmxcktQTZoba2JQdKIDUJSt5ifqq+axEWP+P2ATmYFI6is9bLIy2Jd0Q4apWTReN QxhoYfi10/+ZxeaN4Ga+v3XjTaQttVm5wzK5fKLMD9qHMVhDRuMGBmZQbP07bYBGQszz A+bQTtvtji1gYN+DNHaiXeKXKq//AiDl4JDuVwK1sxZTWbYqSkkSAaUx8SORUvCCVx11 Mj8KpTCGXoM5X5RfNWmALKDH10b++faM5wLvNDIfXaRKh/P7sw6Z6jcxiSGPT1udXeom vTYQ== X-Gm-Message-State: AOAM530/sIrJLcPAVuGgw+hbap18bv5azPMkzGItOesCf42FMNrZ1+M0 qYEQ6sCHp68ymvs3UlUjUhZzSNBdMsY3fQ== X-Google-Smtp-Source: ABdhPJzLvuD38YEBXpOAWKr/5u0bmuMtpdmsiXr4KZ/bXX42L1MK3jJOZruVL9B8E3gICbeY9VjDRg== X-Received: by 2002:a5d:6912:: with SMTP id t18mr3967409wru.268.1611918024392; Fri, 29 Jan 2021 03:00:24 -0800 (PST) From: Peter Maydell To: qemu-devel@nongnu.org Subject: [PULL 10/46] configure: cross-compiling with empty cross_prefix Date: Fri, 29 Jan 2021 10:59:36 +0000 Message-Id: <20210129110012.8660-11-peter.maydell@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20210129110012.8660-1-peter.maydell@linaro.org> References: <20210129110012.8660-1-peter.maydell@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2a00:1450:4864:20::42d; envelope-from=peter.maydell@linaro.org; helo=mail-wr1-x42d.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.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @linaro.org) From: Joelle van Dyne The iOS toolchain does not use the host prefix naming convention. So we need to enable cross-compile options while allowing the PREFIX to be blank. Reviewed-by: Philippe Mathieu-Daud=C3=A9 Signed-off-by: Joelle van Dyne Message-id: 20210126012457.39046-3-j@getutm.app Signed-off-by: Peter Maydell --- configure | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/configure b/configure index 8549c7b5ebe..997d83a2ad5 100755 --- a/configure +++ b/configure @@ -238,6 +238,7 @@ cpu=3D"" iasl=3D"iasl" interp_prefix=3D"/usr/gnemul/qemu-%M" static=3D"no" +cross_compile=3D"no" cross_prefix=3D"" audio_drv_list=3D"" block_drv_rw_whitelist=3D"" @@ -469,6 +470,7 @@ for opt do optarg=3D$(expr "x$opt" : 'x[^=3D]*=3D\(.*\)') case "$opt" in --cross-prefix=3D*) cross_prefix=3D"$optarg" + cross_compile=3D"yes" ;; --cc=3D*) CC=3D"$optarg" ;; @@ -1691,7 +1693,7 @@ $(echo Deprecated targets: $deprecated_targets_list |= \ --target-list-exclude=3DLIST exclude a set of targets from the default t= arget-list =20 Advanced options (experts only): - --cross-prefix=3DPREFIX use PREFIX for compile tools [$cross_prefix] + --cross-prefix=3DPREFIX use PREFIX for compile tools, PREFIX can be b= lank [$cross_prefix] --cc=3DCC use C compiler CC [$cc] --iasl=3DIASL use ACPI compiler IASL [$iasl] --host-cc=3DCC use C compiler CC [$host_cc] for code run at @@ -6290,7 +6292,7 @@ if has $sdl2_config; then fi echo "strip =3D [$(meson_quote $strip)]" >> $cross echo "windres =3D [$(meson_quote $windres)]" >> $cross -if test -n "$cross_prefix"; then +if test "$cross_compile" =3D "yes"; then cross_arg=3D"--cross-file config-meson.cross" echo "[host_machine]" >> $cross if test "$mingw32" =3D "yes" ; then --=20 2.20.1 From nobody Thu May 16 19:07:36 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1611918427; cv=none; d=zohomail.com; s=zohoarc; b=JT21QOTO8Geg/jMlERZyWPlBp3KwR1IByw97GrmKNsh+/sMFs0eOoH4Hnp6hUDjkImLDIPexyecCNO/6rx9jhpD76dVrzvJTFf4uO6L+5mI0oxS+IOOw4iXbqDOHsSVPscm2Meg4msd99jGW4/SrQHxqKZKGsLhEhwaYN0CaUis= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1611918427; h=Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=wUKwKAR4mrxHk/aDOVAn0j/MLIPGv5LCN37QdLveryo=; b=YpydU7d4DjHVFIpBs4P4UZI6FV1kXf5vyk/G5xlaiT/VnkD8xyrCCKixPQY1JuEGQQj0XTVFNtL+8W6kYiVCcSTZGrWmFQQD8wBTLW15oD7/lueBVhS3AD33GA+xTtJgcEy73fsUBKaf6B1xMvmn7g2zf/d9v/cmpLT8/81BTC4= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1611918427505461.8787929854966; Fri, 29 Jan 2021 03:07:07 -0800 (PST) Received: from localhost ([::1]:51380 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1l5RcI-0004cy-F0 for importer@patchew.org; Fri, 29 Jan 2021 06:07:06 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:59690) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1l5RW4-0004RG-W2 for qemu-devel@nongnu.org; Fri, 29 Jan 2021 06:00:41 -0500 Received: from mail-wr1-x42b.google.com ([2a00:1450:4864:20::42b]:37915) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1l5RVr-0006yX-Mg for qemu-devel@nongnu.org; Fri, 29 Jan 2021 06:00:40 -0500 Received: by mail-wr1-x42b.google.com with SMTP id s7so5397447wru.5 for ; Fri, 29 Jan 2021 03:00:26 -0800 (PST) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [81.2.115.148]) by smtp.gmail.com with ESMTPSA id w20sm9268761wmm.12.2021.01.29.03.00.24 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 29 Jan 2021 03:00:24 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:subject:date:message-id:in-reply-to:references:mime-version :content-transfer-encoding; bh=wUKwKAR4mrxHk/aDOVAn0j/MLIPGv5LCN37QdLveryo=; b=SmZ3tJYK8HHwcR+p+8matgsOpGA2MXXFKtUaIt+hhaWb5lnWlNwNznBge3Oek8a0F/ ln5ykOBEJliA4tdXxavCPasSZCvGWCSkhXOQOok3beytj0ogtAF/8nq6qnY9x4FjJLKv tWQm/uEe+cIC7T3AaD4oPQND4QAMjrZ8/CjH+K/+6B2i/t6oo9Zj3MCREZW4K+kAHg5b gDvwcYGIDDDJQvPiym045x52hW2To9AmvEGAPcSyS/HaY+XLVw5x8zh8xREor3XEcij5 HLo26Yx4OpoHIQ4x7huw0UKuA6/+fL1l3e8qTphwxY6N0zDv8pOdpdMc93soOkUbK7kP pdwA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=wUKwKAR4mrxHk/aDOVAn0j/MLIPGv5LCN37QdLveryo=; b=MJzkcXtYROMCDr9GhTGUPjkK2dG7wg5aUDuj1IyQDXfFckH+V+s5BaoAlYb8gi0GY+ 9GFU8QMZEbIaVgiy1F8lXW6eMzGdjdwuwZm5gI6GOl1Pt4t+f60PEMU4eqxBpQEESyHU li+CbE+tq5NNPC2kOwmgZUR2NejIi7Qyda8LCJ/qJjFu6gqLF/PE3TirdR86csZkb702 3oemIkV4bNn/DxZ/MIOlXTEXWovbe60WOzn7cCUTkCckjhaQZkDM5oQtBaEeSd/DNmFB UzH3/1M5xI3+IPG2sSCcGPWKgOh6Tbj/UXunmHk67SiSFt2cYWLRIZUQSlu0S2nNN6KG xCnA== X-Gm-Message-State: AOAM531jq5asAUuQbx1Hze8zxWkBEQ2G69EA0gN15BE17LHzrMRngGCl x8REHE3ug4jn4eROp2iw7kHGbv6ExP7/Hw== X-Google-Smtp-Source: ABdhPJza/WWcLi6S3aZ5qaA593ToT5yzglCGTLAFSv2xjypUa1mMKQKfa43XAakL/8P/x9KAjIzMtg== X-Received: by 2002:adf:b1da:: with SMTP id r26mr4129130wra.198.1611918025270; Fri, 29 Jan 2021 03:00:25 -0800 (PST) From: Peter Maydell To: qemu-devel@nongnu.org Subject: [PULL 11/46] osdep: build with non-working system() function Date: Fri, 29 Jan 2021 10:59:37 +0000 Message-Id: <20210129110012.8660-12-peter.maydell@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20210129110012.8660-1-peter.maydell@linaro.org> References: <20210129110012.8660-1-peter.maydell@linaro.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2a00:1450:4864:20::42b; envelope-from=peter.maydell@linaro.org; helo=mail-wr1-x42b.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.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @linaro.org) Content-Type: text/plain; charset="utf-8" From: Joelle van Dyne Build without error on hosts without a working system(). If system() is called, return -1 with ENOSYS. Signed-off-by: Joelle van Dyne Message-id: 20210126012457.39046-6-j@getutm.app Reviewed-by: Peter Maydell Signed-off-by: Peter Maydell --- meson.build | 1 + include/qemu/osdep.h | 12 ++++++++++++ 2 files changed, 13 insertions(+) diff --git a/meson.build b/meson.build index 27c31caa2d1..9ecb09dfe21 100644 --- a/meson.build +++ b/meson.build @@ -1127,6 +1127,7 @@ config_host_data.set('HAVE_DRM_H', cc.has_header('lib= drm/drm.h')) config_host_data.set('HAVE_PTY_H', cc.has_header('pty.h')) config_host_data.set('HAVE_SYS_IOCCOM_H', cc.has_header('sys/ioccom.h')) config_host_data.set('HAVE_SYS_KCOV_H', cc.has_header('sys/kcov.h')) +config_host_data.set('HAVE_SYSTEM_FUNCTION', cc.has_function('system', pre= fix: '#include ')) =20 config_host_data.set('CONFIG_PREADV', cc.has_function('preadv', prefix: '#= include ')) =20 diff --git a/include/qemu/osdep.h b/include/qemu/osdep.h index b6ffdc15bf3..ba15be9c569 100644 --- a/include/qemu/osdep.h +++ b/include/qemu/osdep.h @@ -710,4 +710,16 @@ static inline void qemu_thread_jit_write(void) {} static inline void qemu_thread_jit_execute(void) {} #endif =20 +/** + * Platforms which do not support system() return ENOSYS + */ +#ifndef HAVE_SYSTEM_FUNCTION +#define system platform_does_not_support_system +static inline int platform_does_not_support_system(const char *command) +{ + errno =3D ENOSYS; + return -1; +} +#endif /* !HAVE_SYSTEM_FUNCTION */ + #endif --=20 2.20.1 From nobody Thu May 16 19:07:36 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1611918298; cv=none; d=zohomail.com; s=zohoarc; b=dUtXHYx8xw7oqsM40HGkJ6lRqr2BZHhQACnYQ8Nk8dMaH1iRz/LiQ1jrA+ZOS+vwvG9EDxz2ATXXmhhExKVLcq9I5wnzBnP0l2JX/EpbKKAcVYu3dfoNvcO9K/gewjhqxMaeWuqYSq+8/yMIaDj8+AL9zsizA1h+QGc3Z9c1Thc= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1611918298; h=Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=vj7rZ69jTyQWeBFA+qT+x/s0CHWbrwOg1pCiOTgesBs=; b=kwVeGq4HFBXYJiPP+N5ApjMfo+7YkE+UJ85IA16GDmqumxp0t4nXAq1KdTyVWdq2XR7VvxcRiebibDWH1/J8MNR6C3qFlGy1+5zgTMGcpJls5Tm+tsmSNqL2WA+95KbaimzX5kBo+w5jp2g+5ELdOWCBoV/4Rmn/9OlnpHQbXDw= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1611918298302746.9405731804271; Fri, 29 Jan 2021 03:04:58 -0800 (PST) Received: from localhost ([::1]:43122 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1l5RaC-0001HI-9g for importer@patchew.org; Fri, 29 Jan 2021 06:04:56 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:59738) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1l5RW7-0004WN-9I for qemu-devel@nongnu.org; Fri, 29 Jan 2021 06:00:43 -0500 Received: from mail-wr1-x431.google.com ([2a00:1450:4864:20::431]:40609) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1l5RVr-0006zE-T2 for qemu-devel@nongnu.org; Fri, 29 Jan 2021 06:00:42 -0500 Received: by mail-wr1-x431.google.com with SMTP id c12so8391564wrc.7 for ; Fri, 29 Jan 2021 03:00:27 -0800 (PST) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [81.2.115.148]) by smtp.gmail.com with ESMTPSA id w20sm9268761wmm.12.2021.01.29.03.00.25 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 29 Jan 2021 03:00:25 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:subject:date:message-id:in-reply-to:references:mime-version :content-transfer-encoding; bh=vj7rZ69jTyQWeBFA+qT+x/s0CHWbrwOg1pCiOTgesBs=; b=JdwpUxM/pyCCA1vLBr5vkjKxDrQohLe9ektaVJSBUZz3Gaczp4G/CqzieovXsFEkJC b91IsjCf8/Z7dKAQGZKP4InG+rbX/E+aMfQf8VJpcJHLM7VKAQv/KdC86ycf8Y/75VbE gVrEhZvFlfTVWpAcb9InI9PCPtkYsGOBUBUnzzm05vdGYUla7xo4EMmwmS+iG/z7kjq4 aWgXAgMzSrAbClHUFJATAXVH2ht1ZR+Pg5kFL9nh8DdOMsHT4eiJEMWM6mAlz/Knoq47 gtc92lKQyauHpqcRuUGNDnnpMzBYXNy8KxcAA7IBpT9fnah4Ta0B4I737eUYZrPkWHQm fjEg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=vj7rZ69jTyQWeBFA+qT+x/s0CHWbrwOg1pCiOTgesBs=; b=gYNFIfJm7uKVqr/SyEfbvxHMOGn8CdichqQbig+JGmUxV/U4O4xS7m4nvuysp6y5fg pPP5WUx1vst7uqpBIs8Zd/Q+fXLkSGOmdziUvw7gDfAx10fDOtVt/bZadPInGeOz60Hb /gEAhPj64Eg/pPm3T4zKNdDh+2P3O3Bo/KELmIJxAh63T70H6GhjlhGbZFB3SBAzCzEV a77BpFgLLU7deOSNRtjhNm9JDRmh0QcjVYiD3dokQqSGJXwFYhV9EP162cQ+5HalT+aJ EoyL4TE1CkCnBWHMrfqzN9vQ2XN5qnJo5ntrQ1J72vcELH84cBgB2BTEv0luXRzHKFx4 CinA== X-Gm-Message-State: AOAM533S3eGwbl+NCp7ZvR0SkaEuUn9BobTq6NIR5oU29w68TXGqrbcn kFfpAoIy9r5+VhGb8leJMCl9oaph8U9TXA== X-Google-Smtp-Source: ABdhPJy1ATejZdRdv3D1jLSOzoQ0O5C81yBpp90t1Z5pPDSxjWCikFEpzseov7vN77+Su6ZPTi7ZDw== X-Received: by 2002:adf:e807:: with SMTP id o7mr4079913wrm.308.1611918026068; Fri, 29 Jan 2021 03:00:26 -0800 (PST) From: Peter Maydell To: qemu-devel@nongnu.org Subject: [PULL 12/46] darwin: remove redundant dependency declaration Date: Fri, 29 Jan 2021 10:59:38 +0000 Message-Id: <20210129110012.8660-13-peter.maydell@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20210129110012.8660-1-peter.maydell@linaro.org> References: <20210129110012.8660-1-peter.maydell@linaro.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2a00:1450:4864:20::431; envelope-from=peter.maydell@linaro.org; helo=mail-wr1-x431.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.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @linaro.org) Content-Type: text/plain; charset="utf-8" From: Joelle van Dyne Meson will find CoreFoundation, IOKit, and Cocoa as needed. Reviewed-by: Peter Maydell Signed-off-by: Joelle van Dyne Message-id: 20210126012457.39046-7-j@getutm.app Signed-off-by: Peter Maydell --- configure | 1 - 1 file changed, 1 deletion(-) diff --git a/configure b/configure index 997d83a2ad5..cd44b21149e 100755 --- a/configure +++ b/configure @@ -780,7 +780,6 @@ Darwin) fi audio_drv_list=3D"coreaudio try-sdl" audio_possible_drivers=3D"coreaudio sdl" - QEMU_LDFLAGS=3D"-framework CoreFoundation -framework IOKit $QEMU_LDFLAGS" # Disable attempts to use ObjectiveC features in os/object.h since they # won't work when we're compiling with gcc as a C compiler. QEMU_CFLAGS=3D"-DOS_OBJECT_USE_OBJC=3D0 $QEMU_CFLAGS" --=20 2.20.1 From nobody Thu May 16 19:07:36 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1611918429; cv=none; d=zohomail.com; s=zohoarc; b=TKY8XOFhxUUdO36cbYVWGLIPlM7374venj5KtXdmw4/KWBk5/uCSNCC80hGW+KOdPO6Z7TSeNyb5Tv7XtLW5mQW0fzokjCJjkRYHyCg604cEvoU/qbu7UvSwnwRo5il9pFmVvuG4mU/WDyXdzTS19g7HfmBzp7rMqU1DG3QRRxE= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1611918429; h=Content-Type:Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=rIuJfM2H38AD9rjbnhVNMilR5WET5VmWsDJu8FbR7Kk=; b=NmaZ1yNx33Mc5akUr8L04B0UnfNbI0WhvGXdsN0euVtw7CI2RMh23VP5/wJg29szyMqDn4RLNYk1JbG8rALWS+8CEIzO2uK0dy5SOQxflMIs6jdo7SoA4Z341/EJixOoK3zaI0We35TPIKWPCGOj07HOv3DwvuragUhmm6p98TQ= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1611918429854831.9911841686204; Fri, 29 Jan 2021 03:07:09 -0800 (PST) Received: from localhost ([::1]:51644 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1l5RcK-0004jK-QD for importer@patchew.org; Fri, 29 Jan 2021 06:07:08 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:59708) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1l5RW6-0004Ss-0d for qemu-devel@nongnu.org; Fri, 29 Jan 2021 06:00:42 -0500 Received: from mail-wr1-x429.google.com ([2a00:1450:4864:20::429]:41456) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1l5RVt-0006zJ-VS for qemu-devel@nongnu.org; Fri, 29 Jan 2021 06:00:41 -0500 Received: by mail-wr1-x429.google.com with SMTP id p15so8367314wrq.8 for ; Fri, 29 Jan 2021 03:00:27 -0800 (PST) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [81.2.115.148]) by smtp.gmail.com with ESMTPSA id w20sm9268761wmm.12.2021.01.29.03.00.26 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 29 Jan 2021 03:00:26 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:subject:date:message-id:in-reply-to:references:mime-version :content-transfer-encoding; bh=rIuJfM2H38AD9rjbnhVNMilR5WET5VmWsDJu8FbR7Kk=; b=O0tlptxZMfjsEhViqgb9I6N859ZACKi777y3RTVFD0ldaxGLvxbJNYPhY86TxjSRsT qiNQDk0g50I649uiFBB6Z5GGspx2DS4SVdrr7pDUcvF12zAx1h8pE0SVz2EO3rEJPWpO 8QVrsLdVPLwMTSpNLzdetIRskl7tOqP9tDC9jZp2IIcsi7oK4JT6PrGVAQniqRELeAUo 6xlASO8DBudY455wPa30KcmO/rzNIgpxr6O6zUvDmwVOskD7Bq9P19RJp2oERtdED9FL 2VVfDJ7ElvVD4ACV56fBBrSc2Q1E9dTZbqEjoobQUgjROn0PiGh2W/4Gzf0EpgWDWTXW ckUw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=rIuJfM2H38AD9rjbnhVNMilR5WET5VmWsDJu8FbR7Kk=; b=HRo8LSBGPY0oCXPjVfwUWYJ7giQ7yNOCf9f52W0tJWy5/wabO7vmaXNz0F/nQNVHtl aTg23W5eqaCXBHSeTxlbSPegsnWbEjgMRdW9HiHuV7Dd39MXBk/pNn8/8Si03hmwXIDp AX5VRsPSi78zook0wvnIIuzmg8rz0RF5QWSz+zsOeitQT1fEfJnW+ewoeXSAquqoLNGG lfwVfvh/0r3ztTfPnjmSwVs5+FIhz2Wh0dKHHEJEIDOEyxMTYHqZ9ojzsByeilxJWrQY LgYPyleH6IEORRRXEKRld5ydVJpwamnkNjIW1AU2gK1SmtAn+HhqmvrL5lZ7uIYx4xOX 4S/A== X-Gm-Message-State: AOAM5331WfDKBqQ5DyXSat5YfSby9qi/L/m4uJHchS1Ke/yqW137kn4P /8WFA6/SpBfrc8DEb4H/TfEK5KL2t+1KJQ== X-Google-Smtp-Source: ABdhPJyO6uNc9rzZy8NQj412MWAy4bqwJwxtmGbByLS8JJ0M770NUFK1nvg6JwhzXEiP4OdVYtIEJA== X-Received: by 2002:a05:6000:1105:: with SMTP id z5mr3874614wrw.15.1611918026940; Fri, 29 Jan 2021 03:00:26 -0800 (PST) From: Peter Maydell To: qemu-devel@nongnu.org Subject: [PULL 13/46] darwin: fix cross-compiling for Darwin Date: Fri, 29 Jan 2021 10:59:39 +0000 Message-Id: <20210129110012.8660-14-peter.maydell@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20210129110012.8660-1-peter.maydell@linaro.org> References: <20210129110012.8660-1-peter.maydell@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2a00:1450:4864:20::429; envelope-from=peter.maydell@linaro.org; helo=mail-wr1-x429.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.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @linaro.org) From: Joelle van Dyne Add objc to the Meson cross file as well as detection of Darwin. Reviewed-by: Peter Maydell Signed-off-by: Joelle van Dyne Reviewed-by: Philippe Mathieu-Daud=C3=A9 Message-id: 20210126012457.39046-8-j@getutm.app Signed-off-by: Peter Maydell --- configure | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/configure b/configure index cd44b21149e..e520a434065 100755 --- a/configure +++ b/configure @@ -6282,6 +6282,7 @@ echo "cpp_link_args =3D [${LDFLAGS:+$(meson_quote $LD= FLAGS)}]" >> $cross echo "[binaries]" >> $cross echo "c =3D [$(meson_quote $cc)]" >> $cross test -n "$cxx" && echo "cpp =3D [$(meson_quote $cxx)]" >> $cross +test -n "$objcc" && echo "objc =3D [$(meson_quote $objcc)]" >> $cross echo "ar =3D [$(meson_quote $ar)]" >> $cross echo "nm =3D [$(meson_quote $nm)]" >> $cross echo "pkgconfig =3D [$(meson_quote $pkg_config_exe)]" >> $cross @@ -6300,6 +6301,9 @@ if test "$cross_compile" =3D "yes"; then if test "$linux" =3D "yes" ; then echo "system =3D 'linux'" >> $cross fi + if test "$darwin" =3D "yes" ; then + echo "system =3D 'darwin'" >> $cross + fi case "$ARCH" in i386|x86_64) echo "cpu_family =3D 'x86'" >> $cross --=20 2.20.1 From nobody Thu May 16 19:07:36 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1611918429; cv=none; d=zohomail.com; s=zohoarc; b=NSDDIqMi5vkbk9kUBfqumtQ08uMWxkbj64BkOLlhrZwZ6zuLLorjWXsheYx8UwJhRVz0BbilkVe+PoNMotjYnliAj599XtFYkOHwDOCxiSMkI6ZgUZaaYryLDQSdQize+cWEsDexqn/mB18h1yderPFTvtaMDjnByi6BRXyEabU= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1611918429; h=Content-Type:Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=H8+6iM9UPg6CtT6aaD4pRiWzKNKK/cDriKvv+fclduU=; b=eJO7Q9ivsYkEeh5WUNR/PG85p3W1PdnnuiySOF1kbWDPktKLzT66aLX+0NjvuWwWOXQU5H+4WwnUm/XMA3qXN/R+sorq0+qwq/LlzvFzvpwWTesAvqtMzof539NHAwIqfhz7bMW+rHGsTQ0rqkdBh1mE/bx5uSgWDItFossagkk= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1611918429694884.4449629189684; Fri, 29 Jan 2021 03:07:09 -0800 (PST) Received: from localhost ([::1]:51614 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1l5RcK-0004iZ-M1 for importer@patchew.org; Fri, 29 Jan 2021 06:07:08 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:59762) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1l5RW8-0004Yi-7Q for qemu-devel@nongnu.org; Fri, 29 Jan 2021 06:00:44 -0500 Received: from mail-wr1-x431.google.com ([2a00:1450:4864:20::431]:37921) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1l5RVv-0006zP-IK for qemu-devel@nongnu.org; Fri, 29 Jan 2021 06:00:43 -0500 Received: by mail-wr1-x431.google.com with SMTP id s7so5397577wru.5 for ; Fri, 29 Jan 2021 03:00:28 -0800 (PST) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [81.2.115.148]) by smtp.gmail.com with ESMTPSA id w20sm9268761wmm.12.2021.01.29.03.00.27 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 29 Jan 2021 03:00:27 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:subject:date:message-id:in-reply-to:references:mime-version :content-transfer-encoding; bh=H8+6iM9UPg6CtT6aaD4pRiWzKNKK/cDriKvv+fclduU=; b=ooVFQI5onsv5dXiHEq4isV1+BXuPWHHtmxkMJ3ydJn9KU85GwEwXfNVFQYnj7OVl0B bzTZynwPZAzXON/U13Ssf/z1NmEH+RYBgVKdzzzcCYL+wM6JntOMWruCKgreNph6Ts4q ZpOMdmligNvsWm6Cv1ORTFl/wEYAZ3RvQ6eqix4hUgr3tEVP2pOyRXC70YZQy439QpCq qSLEJLgiNX3PmlDxg0lDKeIaiPCCQXpzeyhLImdTiRl9Y7vEX2f3aj0RBa4og+tRAmWA DTX/oHaAxA9UKcksvF9zbH2/axsyOLli0Y+mgxXLWEu6qZ/6tudZnAWQGqgbgx8D1qXN 2zxQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=H8+6iM9UPg6CtT6aaD4pRiWzKNKK/cDriKvv+fclduU=; b=UbsbRgU6hQRVDaB3B9WN509XonG4vx0C8KIhg54Js8F0YAt3ziBFEI6HhZB9UcjSeX BsrgaeD+NcwKS/o93mQVAOFvWUWpU71zvQMbe5YK/5f5a2Y8FPEoW6UdyQnbf4sOocZp AxN0DxGus1SyLp3R/SeHP/S6DqWsLyuqxIPIOXSa1WEkgDy5Zd6UQSOm9q33iZs2m+R+ vW7ursWQdHktUMF/HwO0AiLDj1UkU8mzvFQ2TmFNDYurHLNLB/cKqbcawlf5Ydc3rSe7 s2mGn1SOS/WYaVEKx18T7LigepUkt5Vb0UBL21arUm8XDClvJC+MWIxqs2bEIC847xzT 5yuw== X-Gm-Message-State: AOAM530GWGHeved6oMRG8gMdtKS0XsQuk7SGaaXzWXFf2fpyQgEvXNy7 jo+Sx0dlCBuXAa4F+oUePyubVKNRAD7jAw== X-Google-Smtp-Source: ABdhPJyWmJCDhI3ZgRhu6nM2en9ws/x80kcdwp7VJM4tedZSkuvdvoWantCwvh4VCBDQfw3jh5EG1w== X-Received: by 2002:adf:e80f:: with SMTP id o15mr3873493wrm.366.1611918027679; Fri, 29 Jan 2021 03:00:27 -0800 (PST) From: Peter Maydell To: qemu-devel@nongnu.org Subject: [PULL 14/46] configure: cross compile should use x86_64 cpu_family Date: Fri, 29 Jan 2021 10:59:40 +0000 Message-Id: <20210129110012.8660-15-peter.maydell@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20210129110012.8660-1-peter.maydell@linaro.org> References: <20210129110012.8660-1-peter.maydell@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2a00:1450:4864:20::431; envelope-from=peter.maydell@linaro.org; helo=mail-wr1-x431.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.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @linaro.org) From: Joelle van Dyne Reviewed-by: Philippe Mathieu-Daud=C3=A9 Signed-off-by: Joelle van Dyne Message-id: 20210126012457.39046-9-j@getutm.app Signed-off-by: Peter Maydell --- configure | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/configure b/configure index e520a434065..5cf075ac60e 100755 --- a/configure +++ b/configure @@ -6305,9 +6305,12 @@ if test "$cross_compile" =3D "yes"; then echo "system =3D 'darwin'" >> $cross fi case "$ARCH" in - i386|x86_64) + i386) echo "cpu_family =3D 'x86'" >> $cross ;; + x86_64) + echo "cpu_family =3D 'x86_64'" >> $cross + ;; ppc64le) echo "cpu_family =3D 'ppc64'" >> $cross ;; --=20 2.20.1 From nobody Thu May 16 19:07:36 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1611918741; cv=none; d=zohomail.com; s=zohoarc; b=WKixS/IqgR7sGh7cVfwTeXSUq9LTRTSr0iAFKgHjbJkFVgP18VtiSgreGK3yYCv1ehGv4TfIG2HpOqqOqV8Jwfg6b055/Y7FO6BpSm4WSCqUsI1BiglrgA6UsAhsh2e2x7YFVBXYyKCpH3LmYsebbcztM6cDGEIidKYX4dzzeJg= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1611918741; h=Content-Type:Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=zFshe6a9XOs+UpYhaoy/bCbUaTZ0COXMECt5cI7PQd8=; b=AFcDH0bVMjSOrJ5B9jtjXad10WhnLyY43wenr0i3xQSIZ9znRQF4UcoLdNAjC00W5SzqqzYQ4TSwTAS7Ok6/ruAGPGccRD2ZqcnlNt8ZFYHypxZLNUdXvOAk3CIX5qVRG2eKv9etOITPL+sc+o6KKGQlEptjIHovOiOrfVw0tS4= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1611918741179462.6558804060902; Fri, 29 Jan 2021 03:12:21 -0800 (PST) Received: from localhost ([::1]:43696 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1l5RhM-0004eV-41 for importer@patchew.org; Fri, 29 Jan 2021 06:12:20 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:59806) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1l5RW9-0004ck-S8 for qemu-devel@nongnu.org; Fri, 29 Jan 2021 06:00:45 -0500 Received: from mail-wr1-x432.google.com ([2a00:1450:4864:20::432]:45856) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1l5RVx-0006zU-JH for qemu-devel@nongnu.org; Fri, 29 Jan 2021 06:00:45 -0500 Received: by mail-wr1-x432.google.com with SMTP id m13so8384001wro.12 for ; Fri, 29 Jan 2021 03:00:29 -0800 (PST) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [81.2.115.148]) by smtp.gmail.com with ESMTPSA id w20sm9268761wmm.12.2021.01.29.03.00.27 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 29 Jan 2021 03:00:28 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:subject:date:message-id:in-reply-to:references:mime-version :content-transfer-encoding; bh=zFshe6a9XOs+UpYhaoy/bCbUaTZ0COXMECt5cI7PQd8=; b=yD4+BBLsRwM9XpgywxFDhTiYSby5V7R0G5WdUBdsYIuMS36w+UhTy6GwWCBgOUnZBW S+QPX9CtEdH6R3yJiHxv341fTGlf3ofCRZSOy5fNbYmJN3LoIyY3LpMkEouQYdd3/H+O FozKmNWJHyby6XAFf9bfcVUEmguvpeFyvWktnaWYY5/0TKwXx0YJdTcwbPbJM7opMViM d6JChUGvWOHC1WhU9jYP7NOaPakLoreA/dtsAfeuWFXPRJxrpUppkLzkCkgEmb2psUUO DaibqDKgW35tvRTY5DEdWuANR5/qSL739DGxLkQyVc+OqGdvKVYeLwCgygUQX/cDGXwA 6HSQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=zFshe6a9XOs+UpYhaoy/bCbUaTZ0COXMECt5cI7PQd8=; b=P1GE52z/byD0M6WMDs0yivXmteC7DqCVy+CDacuRQotAh33fN+RSpacFicWLUMU4b0 r63i+FvRoI8XSJUqAX++82DLGnyF4VVgSyhQirRJpnkkkWBm5rSpiFAI1ObqJZMKPLJx 9GewPHNACcTWV2pTTthVy+n/pYCcS1PKJfKX5NSiV6KvDYojkD+445MBKdB2LnAhn01+ E76jGvgedBPTiyMABLmiW9fjuAusdVbP7swQNCPN+Q9IVOymKpSq7udBhLZQZWlEL2/O O2pVtUqDXlAXIfYL3nLqFViqT0RY83kAmMOMS7d3+HTpH/wG3LAbzHkd5p+pTcBEy1hv homw== X-Gm-Message-State: AOAM531Z35b1PkvCMiozj5Ket4QyuGyVcwVnjd8CyIYx2afsoIp2NpGs 2wMhw7bKNEsk418b4F3B80xYH8OywSwFSA== X-Google-Smtp-Source: ABdhPJytGBSV6M4Dout4xPqTcitdIvuF5OU8ecgh/opSBelyZfewgzW6dx7V65b4kLDKLcx8NY2PDg== X-Received: by 2002:adf:eb4e:: with SMTP id u14mr3882960wrn.99.1611918028674; Fri, 29 Jan 2021 03:00:28 -0800 (PST) From: Peter Maydell To: qemu-devel@nongnu.org Subject: [PULL 15/46] darwin: detect CoreAudio for build Date: Fri, 29 Jan 2021 10:59:41 +0000 Message-Id: <20210129110012.8660-16-peter.maydell@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20210129110012.8660-1-peter.maydell@linaro.org> References: <20210129110012.8660-1-peter.maydell@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2a00:1450:4864:20::432; envelope-from=peter.maydell@linaro.org; helo=mail-wr1-x432.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.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @linaro.org) From: Joelle van Dyne On iOS there is no CoreAudio, so we should not assume Darwin always has it. Signed-off-by: Joelle van Dyne Reviewed-by: Philippe Mathieu-Daud=C3=A9 Message-id: 20210126012457.39046-11-j@getutm.app Signed-off-by: Peter Maydell --- configure | 35 +++++++++++++++++++++++++++++++++-- 1 file changed, 33 insertions(+), 2 deletions(-) diff --git a/configure b/configure index 5cf075ac60e..99bf6275087 100755 --- a/configure +++ b/configure @@ -319,6 +319,7 @@ fdt=3D"auto" netmap=3D"no" sdl=3D"auto" sdl_image=3D"auto" +coreaudio=3D"auto" virtiofsd=3D"auto" virtfs=3D"auto" libudev=3D"auto" @@ -778,7 +779,7 @@ Darwin) QEMU_CFLAGS=3D"-arch x86_64 $QEMU_CFLAGS" QEMU_LDFLAGS=3D"-arch x86_64 $QEMU_LDFLAGS" fi - audio_drv_list=3D"coreaudio try-sdl" + audio_drv_list=3D"try-coreaudio try-sdl" audio_possible_drivers=3D"coreaudio sdl" # Disable attempts to use ObjectiveC features in os/object.h since they # won't work when we're compiling with gcc as a C compiler. @@ -3146,6 +3147,24 @@ EOF fi fi =20 +########################################## +# detect CoreAudio +if test "$coreaudio" !=3D "no" ; then + coreaudio_libs=3D"-framework CoreAudio" + cat > $TMPC << EOF +#include +int main(void) +{ + return (int)AudioGetCurrentHostTime(); +} +EOF + if compile_prog "" "$coreaudio_libs" ; then + coreaudio=3Dyes + else + coreaudio=3Dno + fi +fi + ########################################## # Sound support libraries probe =20 @@ -3202,8 +3221,20 @@ for drv in $audio_drv_list; do fi ;; =20 - coreaudio) + coreaudio | try-coreaudio) + if test "$coreaudio" =3D "no"; then + if test "$drv" =3D "try-coreaudio"; then + audio_drv_list=3D$(echo "$audio_drv_list" | sed -e 's/try-coreaudi= o//') + else + error_exit "$drv check failed" \ + "Make sure to have the $drv is available." + fi + else coreaudio_libs=3D"-framework CoreAudio" + if test "$drv" =3D "try-coreaudio"; then + audio_drv_list=3D$(echo "$audio_drv_list" | sed -e 's/try-coreaudi= o/coreaudio/') + fi + fi ;; =20 dsound) --=20 2.20.1 From nobody Thu May 16 19:07:36 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1611918536; cv=none; d=zohomail.com; s=zohoarc; b=Jtapy4qnqvoVxeOAcuQHvYnkq9FVnvyt/ZtneU57JXLnqYkyjfU96K1v6dowkj0Z6bPZS/GqcXYrMUo9kqrO6m/mAwLrIQuSaf9XyRwt6GXWrONV0yQLEqfF7kWbLNxUlFrZxWmAy8LlSyXUd0D2zBBuF42hdnjmlRkdkt8BD8o= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1611918536; h=Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=FjD0OXwGzNNfv2GlQuSHJeUVuFbskTZTRqIPXs9Gv+I=; b=bh4BypXzSOqCbWfsg6477JnnRvj84oyYh+PHKkUSHF5cyHDIAyjbHrpBkjOpM1kuV9caj0jIaDSKH6A2g5x8CO5QKL8OZGFTzIwl2ZHn6CgEXdL3XNepck+GCb2p1znGi4a1s0Z17NE7mYmkhRB/s3hQHr9UyqlWubjGO3KnYwk= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 161191853672590.12133170919083; Fri, 29 Jan 2021 03:08:56 -0800 (PST) Received: from localhost ([::1]:59812 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1l5Re2-00081Y-Jh for importer@patchew.org; Fri, 29 Jan 2021 06:08:54 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:59744) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1l5RW7-0004XO-LX for qemu-devel@nongnu.org; Fri, 29 Jan 2021 06:00:43 -0500 Received: from mail-wm1-x32b.google.com ([2a00:1450:4864:20::32b]:40700) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1l5RVw-0006zY-Qn for qemu-devel@nongnu.org; Fri, 29 Jan 2021 06:00:43 -0500 Received: by mail-wm1-x32b.google.com with SMTP id c127so6804291wmf.5 for ; Fri, 29 Jan 2021 03:00:30 -0800 (PST) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [81.2.115.148]) by smtp.gmail.com with ESMTPSA id w20sm9268761wmm.12.2021.01.29.03.00.28 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 29 Jan 2021 03:00:28 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:subject:date:message-id:in-reply-to:references:mime-version :content-transfer-encoding; bh=FjD0OXwGzNNfv2GlQuSHJeUVuFbskTZTRqIPXs9Gv+I=; b=VUNTc6U4eNi0A2AtcDUlH1IZ9PGcg9XKbk1PVFjeoXxxnRcxQGBtUXDourtzZ2XWJD BcD1Q+MPOclsMb/RHyelOoxhwmqvrrF3qSTTlhtAlNmkrPz74X9XUz9dbL66CenBDako 9tNek22IEMTaMucMRNUnC2EoIv1qPTdLfAIVqSBQ2bVUNnaqSvv4WX7TA8s95Q/6i2DX jLQzeSx6Ho+D9+i2J49osrKse8XxCTquU2wnbE+04q9dYF4ZI5DQdHmE7jUBobfR9W8a IvIqy5QEJtdgojlwlMGeINQPgoXcDok7vQ1peQCyRAH1cZwj74jJPuYwCCuY7d+Azfy1 ffmg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=FjD0OXwGzNNfv2GlQuSHJeUVuFbskTZTRqIPXs9Gv+I=; b=YTiSaPvHCr+j1c9ixydGEaKkKBUa9ePHG958S9zl4aC2KLfnBdXFIwArSnrmUjLj8b tMR1R66H8qVzip/KihffVzdgAvHTBYxnT3NFJnGpEOOs88hbYBfV1N1xKrdfLWPbu923 ZpH17O8KsVxaenDCrc18A2UKrl+ybsMxN1Wv4yTmS7KchpoEZ00Z0Xbkcq9T9KLrk8QJ FxW3EX7bVP+OPEKuE3swjfmWOmiUo45atAU3gXQ4yCrCesc9TGAMeOO2ZofXC8OVAhoe xTWsNDyZdigkOGfUgLiakaU944plhLkN6svkokOzumQaXKJNPNW0HdkVHVfaWMqnK5sp 4h+w== X-Gm-Message-State: AOAM530Ixi8WLUNe0Zc84wyq2IR+0rUE1z20GGpm3W1xyse1GX5UohYS yDoqW+7Jr7DgnFXe0Dk7K2Z2qLTqBICeMQ== X-Google-Smtp-Source: ABdhPJz+k6paP9RFV8GkN6MBbuZmuufuuTuOD24EjGZ4U5UVXp7WsNfdJftuxz/ru43HAlJxYltsmQ== X-Received: by 2002:a7b:cbd5:: with SMTP id n21mr3375267wmi.5.1611918029507; Fri, 29 Jan 2021 03:00:29 -0800 (PST) From: Peter Maydell To: qemu-devel@nongnu.org Subject: [PULL 16/46] darwin: remove 64-bit build detection on 32-bit OS Date: Fri, 29 Jan 2021 10:59:42 +0000 Message-Id: <20210129110012.8660-17-peter.maydell@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20210129110012.8660-1-peter.maydell@linaro.org> References: <20210129110012.8660-1-peter.maydell@linaro.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2a00:1450:4864:20::32b; envelope-from=peter.maydell@linaro.org; helo=mail-wm1-x32b.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.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @linaro.org) Content-Type: text/plain; charset="utf-8" From: Joelle van Dyne A workaround added in early days of 64-bit OSX forced x86_64 if the host machine had 64-bit support. This creates issues when cross- compiling for ARM64. Additionally, the user can always use --cpu=3D* to manually set the host CPU and therefore this workaround should be removed. Reviewed-by: Peter Maydell Signed-off-by: Joelle van Dyne Message-id: 20210126012457.39046-12-j@getutm.app Signed-off-by: Peter Maydell --- configure | 11 ----------- 1 file changed, 11 deletions(-) diff --git a/configure b/configure index 99bf6275087..dd2225010b7 100755 --- a/configure +++ b/configure @@ -625,13 +625,6 @@ fi # the correct CPU with the --cpu option. case $targetos in Darwin) - # on Leopard most of the system is 32-bit, so we have to ask the kernel = if we can - # run 64-bit userspace code. - # If the user didn't specify a CPU explicitly and the kernel says this is - # 64 bit hw, then assume x86_64. Otherwise fall through to the usual det= ection code. - if test -z "$cpu" && test "$(sysctl -n hw.optional.x86_64)" =3D "1"; then - cpu=3D"x86_64" - fi HOST_DSOSUF=3D".dylib" ;; SunOS) @@ -775,10 +768,6 @@ OpenBSD) Darwin) bsd=3D"yes" darwin=3D"yes" - if [ "$cpu" =3D "x86_64" ] ; then - QEMU_CFLAGS=3D"-arch x86_64 $QEMU_CFLAGS" - QEMU_LDFLAGS=3D"-arch x86_64 $QEMU_LDFLAGS" - fi audio_drv_list=3D"try-coreaudio try-sdl" audio_possible_drivers=3D"coreaudio sdl" # Disable attempts to use ObjectiveC features in os/object.h since they --=20 2.20.1 From nobody Thu May 16 19:07:36 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1611918702; cv=none; d=zohomail.com; s=zohoarc; b=P8Gw4aDsPep13pxGdAn9wDby0+tUjg97oJlFvgfvkLne6ahRCmH3ObW99p1zSn8vbfRwCJDwHtNyvY6BiaXDR2rPweR80+WAKrJPTP2UK0j02VmEt3bA/ppI+6pSPboF2uG4PX09oG/B9RM7Dious2lJBGPhyWYU+Ai+Qf1MupU= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1611918702; h=Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=5j5YtwYEiYqHm2x1vtSGXh1Wa3+6ylbZXN+3XxjeIHQ=; b=NdWR01L1UmJaORqzcPOLp3xOMT/EcNWeWtH3Pz3USqttgdGlXpyegYpWya2dqgXivC+QJg04hqsKR3RTtKKSk/4AtuoG1EZZg3Z3vgUEyLYnrwldm3NJrUeWqQxpwRnN6TIUkmdTAyNihNQjSvMrJmhipBtq5c8vjBoTxm7sqdU= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1611918702639921.3453832135319; Fri, 29 Jan 2021 03:11:42 -0800 (PST) Received: from localhost ([::1]:40094 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1l5Rgj-0003Bj-Kg for importer@patchew.org; Fri, 29 Jan 2021 06:11:41 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:59856) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1l5RWC-0004jD-HP for qemu-devel@nongnu.org; Fri, 29 Jan 2021 06:00:48 -0500 Received: from mail-wr1-x429.google.com ([2a00:1450:4864:20::429]:33001) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1l5RVx-00070E-Je for qemu-devel@nongnu.org; Fri, 29 Jan 2021 06:00:48 -0500 Received: by mail-wr1-x429.google.com with SMTP id 7so8418873wrz.0 for ; Fri, 29 Jan 2021 03:00:31 -0800 (PST) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [81.2.115.148]) by smtp.gmail.com with ESMTPSA id w20sm9268761wmm.12.2021.01.29.03.00.29 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 29 Jan 2021 03:00:29 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:subject:date:message-id:in-reply-to:references:mime-version :content-transfer-encoding; bh=5j5YtwYEiYqHm2x1vtSGXh1Wa3+6ylbZXN+3XxjeIHQ=; b=wMbftcIMZfYx+MvX84r64dVIN0UIEpg1pDR9E1yjyLAXgc8RqofgfHU0yrcZWTOohr lHI4gDbSIf7QjseY0CYC6l8v5HBlocP+rURSwFTd9vmKuyEjoxpPqNrnuMSW64azaNdo 0QxG3HC0CHpNXgGY957C/2pUGCtw86nokRqMAzkxqAv+jNVzRP3/PJWOMKgIKQTVF16C Rj9EIbcrXEWcPGfQa9ZgCOBhPrybMG0VES3Ghbp+5p//6/WoGucPid521lCgfKDRG8rT BxOiaqe6xe3kIv9gOO6bvN0iLKbJbfjZtCgqr9eEPRNBAa4t+8MzwOZGe9JnUCc/q+hH nIJw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=5j5YtwYEiYqHm2x1vtSGXh1Wa3+6ylbZXN+3XxjeIHQ=; b=VTstXkSaCBp8jqe6CVTJ4kGF9HyOPSDQSR+9VtzA8gDaOgcWqi4Ugf0QTuxRh8FbUU +DfVFq2mUPHGUmkClQOlJLyX5MdcqSDjpw5ahG1mmyxmoc8HLVPTvYgJGC2rPeRZdl1Z wJpi/kwCouB7pHDDoxs/1ds6JFULD67wCibu1ZjJX9jebssjm3X1ps7DM8Q1oIxEXvMr VnsJAkiaPgj1EF6S9/GKcUxK+pk62YQzB0kXxmaLos+eXfgwgBRVkLglPi3G8qM9KAEp hjKzPvxfaI5nziECAfsaQ0DTRkOQqouDssUSkF4plZ8OxrIJZ5aPVkH9Y/GUz126HAXv P/Mg== X-Gm-Message-State: AOAM533j059QWMXq7+DrO5ImMXLzA+hjsJ0muOVuBzKcm6hRjyJK9MTs e/vw/IpNfWibzeM6eUxu1aRVweCMPvcyZA== X-Google-Smtp-Source: ABdhPJy9jk6dVYS+YYnGvvfE6nJrt0+D0QALBISyxYozeRpGx/o76NB1L1N/KUNuf29mWG5kH5QiuQ== X-Received: by 2002:adf:f749:: with SMTP id z9mr3750893wrp.327.1611918030333; Fri, 29 Jan 2021 03:00:30 -0800 (PST) From: Peter Maydell To: qemu-devel@nongnu.org Subject: [PULL 17/46] hvf: Add hypervisor entitlement to output binaries Date: Fri, 29 Jan 2021 10:59:43 +0000 Message-Id: <20210129110012.8660-18-peter.maydell@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20210129110012.8660-1-peter.maydell@linaro.org> References: <20210129110012.8660-1-peter.maydell@linaro.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2a00:1450:4864:20::429; envelope-from=peter.maydell@linaro.org; helo=mail-wr1-x429.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.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @linaro.org) Content-Type: text/plain; charset="utf-8" From: Alexander Graf In macOS 11, QEMU only gets access to Hypervisor.framework if it has the respective entitlement. Add an entitlement template and automatically self sign and apply the entitlement in the build. Signed-off-by: Alexander Graf Reviewed-by: Roman Bolshakov Tested-by: Roman Bolshakov Signed-off-by: Peter Maydell --- meson.build | 29 +++++++++++++++++++++++++---- accel/hvf/entitlements.plist | 8 ++++++++ scripts/entitlement.sh | 13 +++++++++++++ 3 files changed, 46 insertions(+), 4 deletions(-) create mode 100644 accel/hvf/entitlements.plist create mode 100755 scripts/entitlement.sh diff --git a/meson.build b/meson.build index 9ecb09dfe21..f00b7754fd4 100644 --- a/meson.build +++ b/meson.build @@ -2167,9 +2167,14 @@ foreach target : target_dirs }] endif foreach exe: execs - emulators +=3D {exe['name']: - executable(exe['name'], exe['sources'], - install: true, + exe_name =3D exe['name'] + exe_sign =3D 'CONFIG_HVF' in config_target + if exe_sign + exe_name +=3D '-unsigned' + endif + + emulator =3D executable(exe_name, exe['sources'], + install: not exe_sign, c_args: c_args, dependencies: arch_deps + deps + exe['dependencies'], objects: lib.extract_all_objects(recursive: true), @@ -2177,7 +2182,23 @@ foreach target : target_dirs link_depends: [block_syms, qemu_syms] + exe.get('link_depen= ds', []), link_args: link_args, gui_app: exe['gui']) - } + + if exe_sign + emulators +=3D {exe['name'] : custom_target(exe['name'], + install: true, + install_dir: get_option('bindir'), + depends: emulator, + output: exe['name'], + command: [ + meson.current_source_dir() / 'scripts/entitlement.sh', + meson.current_build_dir() / exe_name, + meson.current_build_dir() / exe['name'], + meson.current_source_dir() / 'accel/hvf/entitlements.= plist' + ]) + } + else + emulators +=3D {exe['name']: emulator} + endif =20 if 'CONFIG_TRACE_SYSTEMTAP' in config_host foreach stp: [ diff --git a/accel/hvf/entitlements.plist b/accel/hvf/entitlements.plist new file mode 100644 index 00000000000..154f3308ef2 --- /dev/null +++ b/accel/hvf/entitlements.plist @@ -0,0 +1,8 @@ + + + + + com.apple.security.hypervisor + + + diff --git a/scripts/entitlement.sh b/scripts/entitlement.sh new file mode 100755 index 00000000000..c540fa6435f --- /dev/null +++ b/scripts/entitlement.sh @@ -0,0 +1,13 @@ +#!/bin/sh -e +# +# Helper script for the build process to apply entitlements + +SRC=3D"$1" +DST=3D"$2" +ENTITLEMENT=3D"$3" + +trap 'rm "$DST.tmp"' exit +cp -af "$SRC" "$DST.tmp" +codesign --entitlements "$ENTITLEMENT" --force -s - "$DST.tmp" +mv "$DST.tmp" "$DST" +trap '' exit --=20 2.20.1 From nobody Thu May 16 19:07:36 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1611918539; cv=none; d=zohomail.com; s=zohoarc; b=hL2ok20qi6F8GMkc3vzE+6gwuB9NosT5ezbnAcjmY1GLniP/7NdZtFwigQ6R1jxnoVyzfxy0Xg/7tF58RHsU+2FioGHhgQwqWJcGdHh6KcuKDUEdKdqFups+XjmzGG58n5xLyI9NPYmiGAW5voFzQH+tDi1NesrD81DxRkngn2Q= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1611918539; h=Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=JxNtuIVt7+VefAfJnlEhCbGDns5pnZHg5md1Cqm/Tes=; b=HwQzHlBJ/ZDnwzfwne3QHusQg4S1fA3DRg02Mt3wJjusbM6+e6XOS2EXiJkcOEypiLir4G1I8x+/r2Sw5nQ7WoEHXRXVDqHPn66Xp0RPuQiWkXUyRuSeLobEXbGQi6v0xmOkzN3BqqJqvyNQqeNOXFoGrIq1wQn+AJA3Zt6tdps= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1611918539680451.09703218964705; Fri, 29 Jan 2021 03:08:59 -0800 (PST) Received: from localhost ([::1]:60160 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1l5Re6-0008AC-JS for importer@patchew.org; Fri, 29 Jan 2021 06:08:58 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:59808) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1l5RWA-0004ds-9F for qemu-devel@nongnu.org; Fri, 29 Jan 2021 06:00:46 -0500 Received: from mail-wr1-x42e.google.com ([2a00:1450:4864:20::42e]:36762) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1l5RVx-00070I-JT for qemu-devel@nongnu.org; Fri, 29 Jan 2021 06:00:45 -0500 Received: by mail-wr1-x42e.google.com with SMTP id 6so8390213wri.3 for ; Fri, 29 Jan 2021 03:00:32 -0800 (PST) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [81.2.115.148]) by smtp.gmail.com with ESMTPSA id w20sm9268761wmm.12.2021.01.29.03.00.30 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 29 Jan 2021 03:00:30 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:subject:date:message-id:in-reply-to:references:mime-version :content-transfer-encoding; bh=JxNtuIVt7+VefAfJnlEhCbGDns5pnZHg5md1Cqm/Tes=; b=hPp7S5YfSwRmMImtoPC/mUxlIoLMq0JhiAgBSy8XHS3Wzqa3GXs9s1xWmq9EpZUoB+ yarXScA/2/JmzVVNoSI/YSt8TVxenoc7C5OJPmqYDLxElje7QQhmzJA6FAUgU/JuDbn6 G/HwLZPuH7fXsvLudhuKZBZK3Yix0MP+Fuqq38hBRH/FstTFw3l8LAnc2K6KmrgQo8rC k1W6VOoPSbeDWWMf5aCyIoZgtu6IpKGHQsBrDLDJUUUHPFfDOMI6gtRhHZOXh384W3+7 MYwJckT/NQ1rD3Gi87n6R6pDaDwRY+TrSNVkIHFpk82znAr4kmy2s/A1A37M/+4+k6Rn su+Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=JxNtuIVt7+VefAfJnlEhCbGDns5pnZHg5md1Cqm/Tes=; b=KIrXG+q6lDEK84pjKd9eCZBOxmQ06nCqUqMRcexhCS+kLLAReopYj4/5FtDoImIb5k C6VHjEZyIm4ppK3hYAPFMbT0iO+qHgFvShpLk5Z/XXs8n0G0tyBhU3gzRyIuYmGchrdI cRikoAhqP53TDLJ4ca+4dYQkfevTKbhbrBuViLFeNGDdL6IZFuJrtjOVrP8F5aJbu4UW eRNkcxFlGMhmZ//9Egg8jmi+5mJEY7bes2JvmSuHuIs6uZKgJBetkRl64HJWLUV8GRBR ToKAGnFSZFXS7Aec6TqmI3LYNVy7YrOXCRUoge7YlWxhen5haRxC9xQmVeu3hVIHgSwZ xZAQ== X-Gm-Message-State: AOAM532u2IrjxEY5LB3e+KdRE37B5ITZqWds+wRT01l0ZI3mY4Y500ob Y1/88TdFg/93EDDMVFQkzyXxKOhczRpvbQ== X-Google-Smtp-Source: ABdhPJw0zRIsZxDoJ7w82hw/lI7mVNYW+xGz96fsjKPeM9UOx8CJcThrCsPeoOgc5xtw2ai3VmGB9A== X-Received: by 2002:adf:9d48:: with SMTP id o8mr3917987wre.408.1611918031335; Fri, 29 Jan 2021 03:00:31 -0800 (PST) From: Peter Maydell To: qemu-devel@nongnu.org Subject: [PULL 18/46] hw/misc/pvpanic: split-out generic and bus dependent code Date: Fri, 29 Jan 2021 10:59:44 +0000 Message-Id: <20210129110012.8660-19-peter.maydell@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20210129110012.8660-1-peter.maydell@linaro.org> References: <20210129110012.8660-1-peter.maydell@linaro.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2a00:1450:4864:20::42e; envelope-from=peter.maydell@linaro.org; helo=mail-wr1-x42e.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.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @linaro.org) Content-Type: text/plain; charset="utf-8" From: Mihai Carabas To ease the PCI device addition in next patches, split the code as follows: - generic code (read/write/setup) is being kept in pvpanic.c - ISA dependent code moved to pvpanic-isa.c Also, rename: - ISA_PVPANIC_DEVICE -> PVPANIC_ISA_DEVICE. - TYPE_PVPANIC -> TYPE_PVPANIC_ISA. - MemoryRegion io -> mr. - pvpanic_ioport_* in pvpanic_*. Update the build system with the new files and config structure. Signed-off-by: Mihai Carabas Reviewed-by: Peter Maydell Signed-off-by: Peter Maydell --- include/hw/misc/pvpanic.h | 23 +++++++++- hw/misc/pvpanic-isa.c | 94 +++++++++++++++++++++++++++++++++++++++ hw/misc/pvpanic.c | 85 +++-------------------------------- hw/i386/Kconfig | 2 +- hw/misc/Kconfig | 6 ++- hw/misc/meson.build | 3 +- tests/qtest/meson.build | 2 +- 7 files changed, 130 insertions(+), 85 deletions(-) create mode 100644 hw/misc/pvpanic-isa.c diff --git a/include/hw/misc/pvpanic.h b/include/hw/misc/pvpanic.h index ae0c8188cef..abc9dde34b3 100644 --- a/include/hw/misc/pvpanic.h +++ b/include/hw/misc/pvpanic.h @@ -17,13 +17,32 @@ =20 #include "qom/object.h" =20 -#define TYPE_PVPANIC "pvpanic" +#define TYPE_PVPANIC_ISA_DEVICE "pvpanic" =20 #define PVPANIC_IOPORT_PROP "ioport" =20 +/* The bit of supported pv event, TODO: include uapi header and remove thi= s */ +#define PVPANIC_F_PANICKED 0 +#define PVPANIC_F_CRASHLOADED 1 + +/* The pv event value */ +#define PVPANIC_PANICKED (1 << PVPANIC_F_PANICKED) +#define PVPANIC_CRASHLOADED (1 << PVPANIC_F_CRASHLOADED) + +/* + * PVPanicState for any device type + */ +typedef struct PVPanicState PVPanicState; +struct PVPanicState { + MemoryRegion mr; + uint8_t events; +}; + +void pvpanic_setup_io(PVPanicState *s, DeviceState *dev, unsigned size); + static inline uint16_t pvpanic_port(void) { - Object *o =3D object_resolve_path_type("", TYPE_PVPANIC, NULL); + Object *o =3D object_resolve_path_type("", TYPE_PVPANIC_ISA_DEVICE, NU= LL); if (!o) { return 0; } diff --git a/hw/misc/pvpanic-isa.c b/hw/misc/pvpanic-isa.c new file mode 100644 index 00000000000..27113abd6cf --- /dev/null +++ b/hw/misc/pvpanic-isa.c @@ -0,0 +1,94 @@ +/* + * QEMU simulated pvpanic device. + * + * Copyright Fujitsu, Corp. 2013 + * + * Authors: + * Wen Congyang + * Hu Tao + * + * This work is licensed under the terms of the GNU GPL, version 2 or late= r. + * See the COPYING file in the top-level directory. + * + */ + +#include "qemu/osdep.h" +#include "qemu/log.h" +#include "qemu/module.h" +#include "sysemu/runstate.h" + +#include "hw/nvram/fw_cfg.h" +#include "hw/qdev-properties.h" +#include "hw/misc/pvpanic.h" +#include "qom/object.h" +#include "hw/isa/isa.h" + +OBJECT_DECLARE_SIMPLE_TYPE(PVPanicISAState, PVPANIC_ISA_DEVICE) + +/* + * PVPanicISAState for ISA device and + * use ioport. + */ +struct PVPanicISAState { + ISADevice parent_obj; + + uint16_t ioport; + PVPanicState pvpanic; +}; + +static void pvpanic_isa_initfn(Object *obj) +{ + PVPanicISAState *s =3D PVPANIC_ISA_DEVICE(obj); + + pvpanic_setup_io(&s->pvpanic, DEVICE(s), 1); +} + +static void pvpanic_isa_realizefn(DeviceState *dev, Error **errp) +{ + ISADevice *d =3D ISA_DEVICE(dev); + PVPanicISAState *s =3D PVPANIC_ISA_DEVICE(dev); + PVPanicState *ps =3D &s->pvpanic; + FWCfgState *fw_cfg =3D fw_cfg_find(); + uint16_t *pvpanic_port; + + if (!fw_cfg) { + return; + } + + pvpanic_port =3D g_malloc(sizeof(*pvpanic_port)); + *pvpanic_port =3D cpu_to_le16(s->ioport); + fw_cfg_add_file(fw_cfg, "etc/pvpanic-port", pvpanic_port, + sizeof(*pvpanic_port)); + + isa_register_ioport(d, &ps->mr, s->ioport); +} + +static Property pvpanic_isa_properties[] =3D { + DEFINE_PROP_UINT16(PVPANIC_IOPORT_PROP, PVPanicISAState, ioport, 0x505= ), + DEFINE_PROP_UINT8("events", PVPanicISAState, pvpanic.events, PVPANIC_P= ANICKED | PVPANIC_CRASHLOADED), + DEFINE_PROP_END_OF_LIST(), +}; + +static void pvpanic_isa_class_init(ObjectClass *klass, void *data) +{ + DeviceClass *dc =3D DEVICE_CLASS(klass); + + dc->realize =3D pvpanic_isa_realizefn; + device_class_set_props(dc, pvpanic_isa_properties); + set_bit(DEVICE_CATEGORY_MISC, dc->categories); +} + +static TypeInfo pvpanic_isa_info =3D { + .name =3D TYPE_PVPANIC_ISA_DEVICE, + .parent =3D TYPE_ISA_DEVICE, + .instance_size =3D sizeof(PVPanicISAState), + .instance_init =3D pvpanic_isa_initfn, + .class_init =3D pvpanic_isa_class_init, +}; + +static void pvpanic_register_types(void) +{ + type_register_static(&pvpanic_isa_info); +} + +type_init(pvpanic_register_types) diff --git a/hw/misc/pvpanic.c b/hw/misc/pvpanic.c index 35d6797831d..e2cb4a5d28a 100644 --- a/hw/misc/pvpanic.c +++ b/hw/misc/pvpanic.c @@ -22,18 +22,6 @@ #include "hw/misc/pvpanic.h" #include "qom/object.h" =20 -/* The bit of supported pv event, TODO: include uapi header and remove thi= s */ -#define PVPANIC_F_PANICKED 0 -#define PVPANIC_F_CRASHLOADED 1 - -/* The pv event value */ -#define PVPANIC_PANICKED (1 << PVPANIC_F_PANICKED) -#define PVPANIC_CRASHLOADED (1 << PVPANIC_F_CRASHLOADED) - -typedef struct PVPanicState PVPanicState; -DECLARE_INSTANCE_CHECKER(PVPanicState, ISA_PVPANIC_DEVICE, - TYPE_PVPANIC) - static void handle_event(int event) { static bool logged; @@ -54,90 +42,29 @@ static void handle_event(int event) } } =20 -#include "hw/isa/isa.h" - -struct PVPanicState { - ISADevice parent_obj; - - MemoryRegion io; - uint16_t ioport; - uint8_t events; -}; - /* return supported events on read */ -static uint64_t pvpanic_ioport_read(void *opaque, hwaddr addr, unsigned si= ze) +static uint64_t pvpanic_read(void *opaque, hwaddr addr, unsigned size) { PVPanicState *pvp =3D opaque; return pvp->events; } =20 -static void pvpanic_ioport_write(void *opaque, hwaddr addr, uint64_t val, +static void pvpanic_write(void *opaque, hwaddr addr, uint64_t val, unsigned size) { handle_event(val); } =20 static const MemoryRegionOps pvpanic_ops =3D { - .read =3D pvpanic_ioport_read, - .write =3D pvpanic_ioport_write, + .read =3D pvpanic_read, + .write =3D pvpanic_write, .impl =3D { .min_access_size =3D 1, .max_access_size =3D 1, }, }; =20 -static void pvpanic_isa_initfn(Object *obj) +void pvpanic_setup_io(PVPanicState *s, DeviceState *dev, unsigned size) { - PVPanicState *s =3D ISA_PVPANIC_DEVICE(obj); - - memory_region_init_io(&s->io, OBJECT(s), &pvpanic_ops, s, "pvpanic", 1= ); + memory_region_init_io(&s->mr, OBJECT(dev), &pvpanic_ops, s, "pvpanic",= size); } - -static void pvpanic_isa_realizefn(DeviceState *dev, Error **errp) -{ - ISADevice *d =3D ISA_DEVICE(dev); - PVPanicState *s =3D ISA_PVPANIC_DEVICE(dev); - FWCfgState *fw_cfg =3D fw_cfg_find(); - uint16_t *pvpanic_port; - - if (!fw_cfg) { - return; - } - - pvpanic_port =3D g_malloc(sizeof(*pvpanic_port)); - *pvpanic_port =3D cpu_to_le16(s->ioport); - fw_cfg_add_file(fw_cfg, "etc/pvpanic-port", pvpanic_port, - sizeof(*pvpanic_port)); - - isa_register_ioport(d, &s->io, s->ioport); -} - -static Property pvpanic_isa_properties[] =3D { - DEFINE_PROP_UINT16(PVPANIC_IOPORT_PROP, PVPanicState, ioport, 0x505), - DEFINE_PROP_UINT8("events", PVPanicState, events, PVPANIC_PANICKED | P= VPANIC_CRASHLOADED), - DEFINE_PROP_END_OF_LIST(), -}; - -static void pvpanic_isa_class_init(ObjectClass *klass, void *data) -{ - DeviceClass *dc =3D DEVICE_CLASS(klass); - - dc->realize =3D pvpanic_isa_realizefn; - device_class_set_props(dc, pvpanic_isa_properties); - set_bit(DEVICE_CATEGORY_MISC, dc->categories); -} - -static TypeInfo pvpanic_isa_info =3D { - .name =3D TYPE_PVPANIC, - .parent =3D TYPE_ISA_DEVICE, - .instance_size =3D sizeof(PVPanicState), - .instance_init =3D pvpanic_isa_initfn, - .class_init =3D pvpanic_isa_class_init, -}; - -static void pvpanic_register_types(void) -{ - type_register_static(&pvpanic_isa_info); -} - -type_init(pvpanic_register_types) diff --git a/hw/i386/Kconfig b/hw/i386/Kconfig index eea059ffef5..7f91f30877f 100644 --- a/hw/i386/Kconfig +++ b/hw/i386/Kconfig @@ -14,7 +14,7 @@ config PC imply ISA_DEBUG imply PARALLEL imply PCI_DEVICES - imply PVPANIC + imply PVPANIC_ISA imply QXL imply SEV imply SGA diff --git a/hw/misc/Kconfig b/hw/misc/Kconfig index cf18ac08e66..23bc9786cf4 100644 --- a/hw/misc/Kconfig +++ b/hw/misc/Kconfig @@ -121,9 +121,13 @@ config IOTKIT_SYSCTL config IOTKIT_SYSINFO bool =20 -config PVPANIC +config PVPANIC_COMMON + bool + +config PVPANIC_ISA bool depends on ISA_BUS + select PVPANIC_COMMON =20 config AUX bool diff --git a/hw/misc/meson.build b/hw/misc/meson.build index 607cd38a210..edaaec2a3ee 100644 --- a/hw/misc/meson.build +++ b/hw/misc/meson.build @@ -13,6 +13,7 @@ softmmu_ss.add(when: 'CONFIG_EMC141X', if_true: files('em= c141x.c')) softmmu_ss.add(when: 'CONFIG_UNIMP', if_true: files('unimp.c')) softmmu_ss.add(when: 'CONFIG_EMPTY_SLOT', if_true: files('empty_slot.c')) softmmu_ss.add(when: 'CONFIG_LED', if_true: files('led.c')) +softmmu_ss.add(when: 'CONFIG_PVPANIC_COMMON', if_true: files('pvpanic.c')) =20 # ARM devices softmmu_ss.add(when: 'CONFIG_PL310', if_true: files('arm_l2x0.c')) @@ -98,7 +99,7 @@ softmmu_ss.add(when: 'CONFIG_IOTKIT_SYSINFO', if_true: fi= les('iotkit-sysinfo.c') softmmu_ss.add(when: 'CONFIG_ARMSSE_CPUID', if_true: files('armsse-cpuid.c= ')) softmmu_ss.add(when: 'CONFIG_ARMSSE_MHU', if_true: files('armsse-mhu.c')) =20 -softmmu_ss.add(when: 'CONFIG_PVPANIC', if_true: files('pvpanic.c')) +softmmu_ss.add(when: 'CONFIG_PVPANIC_ISA', if_true: files('pvpanic-isa.c')) softmmu_ss.add(when: 'CONFIG_AUX', if_true: files('auxbus.c')) softmmu_ss.add(when: 'CONFIG_ASPEED_SOC', if_true: files('aspeed_scu.c', '= aspeed_sdmc.c', 'aspeed_xdma.c')) softmmu_ss.add(when: 'CONFIG_MSF2', if_true: files('msf2-sysreg.c')) diff --git a/tests/qtest/meson.build b/tests/qtest/meson.build index 16d04625b8b..0e85343b96b 100644 --- a/tests/qtest/meson.build +++ b/tests/qtest/meson.build @@ -33,7 +33,7 @@ qtests_i386 =3D \ (config_host.has_key('CONFIG_LINUX') and = \ config_all_devices.has_key('CONFIG_ISA_IPMI_BT') ? ['ipmi-bt-test'] : [= ]) + \ (config_all_devices.has_key('CONFIG_WDT_IB700') ? ['wdt_ib700-test'] : [= ]) + \ - (config_all_devices.has_key('CONFIG_PVPANIC') ? ['pvpanic-test'] : []) += \ + (config_all_devices.has_key('CONFIG_PVPANIC_ISA') ? ['pvpanic-test'] : [= ]) + \ (config_all_devices.has_key('CONFIG_HDA') ? ['intel-hda-test'] : []) + = \ (config_all_devices.has_key('CONFIG_I82801B11') ? ['i82801b11-test'] : [= ]) + \ (config_all_devices.has_key('CONFIG_IOH3420') ? ['ioh3420-test'] : []) += \ --=20 2.20.1 From nobody Thu May 16 19:07:36 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1611918575; cv=none; d=zohomail.com; s=zohoarc; b=Aq9dg8f5KZhzK5hwqOUnwRHR9OuG/rqBYrOIXJMijGR5L5wwVyMHmwBkfGgSfNnv0HljtUB3iaUKNu766XBxxo3LOdbAJN7MusoOIS2oWrQhYbCPJSsWZtCOf+BrXeJ227VTiVwlgYERbj9k5z3NEVOYTxd/D5MemBYajlB4Zw8= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1611918575; h=Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=0TFLeVs+y/8fHPxjoJdC5/wiolow+hEp5ufBaJr3sfc=; b=jguvZbV7kXZA3OIuIkTTyaiqSVe3EtWwBHixMw6EYQE1Jqmefx0zTx3xKHhgl0k87ysDSwjjG2dHvZh9Mi5nK5Nq++9CWa6QsLrTocwnkGXH8UPQfWwE4ofUqNk51LCa77AamchCHQrsUkUheJtEI7BckHmnq9Jc/wbRBKvEvVM= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1611918575115315.94845308890353; Fri, 29 Jan 2021 03:09:35 -0800 (PST) Received: from localhost ([::1]:35054 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1l5Reg-0000ym-37 for importer@patchew.org; Fri, 29 Jan 2021 06:09:34 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:59778) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1l5RW9-0004aS-0N for qemu-devel@nongnu.org; Fri, 29 Jan 2021 06:00:45 -0500 Received: from mail-wm1-x32b.google.com ([2a00:1450:4864:20::32b]:55101) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1l5RVx-00070N-JB for qemu-devel@nongnu.org; Fri, 29 Jan 2021 06:00:44 -0500 Received: by mail-wm1-x32b.google.com with SMTP id u14so6495144wml.4 for ; Fri, 29 Jan 2021 03:00:33 -0800 (PST) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [81.2.115.148]) by smtp.gmail.com with ESMTPSA id w20sm9268761wmm.12.2021.01.29.03.00.31 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 29 Jan 2021 03:00:31 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:subject:date:message-id:in-reply-to:references:mime-version :content-transfer-encoding; bh=0TFLeVs+y/8fHPxjoJdC5/wiolow+hEp5ufBaJr3sfc=; b=MH5bfKmG3LvSf9iGnC8YpGTF693LD6gmLChV2/Mvn1xsZnpM62xES4MhNQw+ghDz7Y iCAfG+3glI9oJxbiRfyjaQaXQkaZpfR68kVBWxh+Da8lKA+jfutTI4tPjTLh34cMGSpU 93xnXQTgH0Zn+ZsSa66ccglPaeSCNl7k6CWZIYSw5kMkH/Aw015cKa6vGJa30J0VxVaa 8b82KJm99qH7pK3+qqfxS7HaoUYMLUCAFBt6A7GwtG2XBbpl8Lo4tREEqNIc5TPDqqLL lGewliWtgmNzxGv1Ai9quv6Sy3513g9rf+idQ0/T8uzgdAooLlBVf1E73YeiSlnKMaGK RgcQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=0TFLeVs+y/8fHPxjoJdC5/wiolow+hEp5ufBaJr3sfc=; b=I3LSU+sUy2a69D6+oh8P7Dk+DX27ikwj/7saHovVfOKFmxOi8EJiV0TdBB2HXtvwxg UE4sOBRu5ZSLi1CEQDLi/ci9db2ECRtKwIX0Oi+giniRUrFR6vKDtD8zf24ReLpYXHQF m7Xo0f1LkYRiMccIpTNT1krSwFDQbXq5ZBbLa7eNzrJ/B+GYFa5aLFNH0UAOtgAl0+B1 4kqVjmYeO3cAR5S/TtN4UFec4I0Fc6EGyc+DP3wcaKsvsiaYVP6eld3faiIUhEPqiUg5 ByQkr4XBvYTv4JrMAW5HPb0+4u4AFrgivhOWYOCmgxAshXtaoHxfPdYNaqgbGGGDMkFq wjFg== X-Gm-Message-State: AOAM533my1CQVsIJQqKfA4RvR4QEEN464M3ZeIglH2EX6H2fXtQAJvOg iYt16IHzrxXnSsWGAuopahdvutATfqeXpg== X-Google-Smtp-Source: ABdhPJxAFrZN6SteFd6MZX15oo6c/Q3G9fpTK/jgXN5BuDp/ubMrOY4456CILaUS6d7226I2otN1qQ== X-Received: by 2002:a1c:e486:: with SMTP id b128mr3236126wmh.136.1611918032240; Fri, 29 Jan 2021 03:00:32 -0800 (PST) From: Peter Maydell To: qemu-devel@nongnu.org Subject: [PULL 19/46] hw/misc/pvpanic: add PCI interface support Date: Fri, 29 Jan 2021 10:59:45 +0000 Message-Id: <20210129110012.8660-20-peter.maydell@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20210129110012.8660-1-peter.maydell@linaro.org> References: <20210129110012.8660-1-peter.maydell@linaro.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2a00:1450:4864:20::32b; envelope-from=peter.maydell@linaro.org; helo=mail-wm1-x32b.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.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @linaro.org) Content-Type: text/plain; charset="utf-8" From: Mihai Carabas Add PCI interface support for PVPANIC device. Create a new file pvpanic-pci= .c where the PCI specific routines reside and update the build system with the= new files and config structure. Signed-off-by: Mihai Carabas Reviewed-by: Gerd Hoffmann Reviewed-by: Peter Maydell Signed-off-by: Mihai Carabas Signed-off-by: Peter Maydell --- docs/specs/pci-ids.txt | 1 + include/hw/misc/pvpanic.h | 1 + include/hw/pci/pci.h | 1 + hw/misc/pvpanic-pci.c | 94 +++++++++++++++++++++++++++++++++++++++ hw/misc/Kconfig | 6 +++ hw/misc/meson.build | 1 + 6 files changed, 104 insertions(+) create mode 100644 hw/misc/pvpanic-pci.c diff --git a/docs/specs/pci-ids.txt b/docs/specs/pci-ids.txt index abbdbca6be3..5e407a6f320 100644 --- a/docs/specs/pci-ids.txt +++ b/docs/specs/pci-ids.txt @@ -64,6 +64,7 @@ PCI devices (other than virtio): 1b36:000d PCI xhci usb host adapter 1b36:000f mdpy (mdev sample device), linux/samples/vfio-mdev/mdpy.c 1b36:0010 PCIe NVMe device (-device nvme) +1b36:0011 PCI PVPanic device (-device pvpanic-pci) =20 All these devices are documented in docs/specs. =20 diff --git a/include/hw/misc/pvpanic.h b/include/hw/misc/pvpanic.h index abc9dde34b3..ca3c5bb5330 100644 --- a/include/hw/misc/pvpanic.h +++ b/include/hw/misc/pvpanic.h @@ -18,6 +18,7 @@ #include "qom/object.h" =20 #define TYPE_PVPANIC_ISA_DEVICE "pvpanic" +#define TYPE_PVPANIC_PCI_DEVICE "pvpanic-pci" =20 #define PVPANIC_IOPORT_PROP "ioport" =20 diff --git a/include/hw/pci/pci.h b/include/hw/pci/pci.h index 259f9c992d5..66db08462fd 100644 --- a/include/hw/pci/pci.h +++ b/include/hw/pci/pci.h @@ -107,6 +107,7 @@ extern bool pci_available; #define PCI_DEVICE_ID_REDHAT_PCIE_BRIDGE 0x000e #define PCI_DEVICE_ID_REDHAT_MDPY 0x000f #define PCI_DEVICE_ID_REDHAT_NVME 0x0010 +#define PCI_DEVICE_ID_REDHAT_PVPANIC 0x0011 #define PCI_DEVICE_ID_REDHAT_QXL 0x0100 =20 #define FMT_PCIBUS PRIx64 diff --git a/hw/misc/pvpanic-pci.c b/hw/misc/pvpanic-pci.c new file mode 100644 index 00000000000..d629639d8f4 --- /dev/null +++ b/hw/misc/pvpanic-pci.c @@ -0,0 +1,94 @@ +/* + * QEMU simulated PCI pvpanic device. + * + * Copyright (C) 2020 Oracle + * + * Authors: + * Mihai Carabas + * + * This work is licensed under the terms of the GNU GPL, version 2 or late= r. + * See the COPYING file in the top-level directory. + * + */ + +#include "qemu/osdep.h" +#include "qemu/log.h" +#include "qemu/module.h" +#include "sysemu/runstate.h" + +#include "hw/nvram/fw_cfg.h" +#include "hw/qdev-properties.h" +#include "migration/vmstate.h" +#include "hw/misc/pvpanic.h" +#include "qom/object.h" +#include "hw/pci/pci.h" + +OBJECT_DECLARE_SIMPLE_TYPE(PVPanicPCIState, PVPANIC_PCI_DEVICE) + +/* + * PVPanicPCIState for PCI device + */ +typedef struct PVPanicPCIState { + PCIDevice dev; + PVPanicState pvpanic; +} PVPanicPCIState; + +static const VMStateDescription vmstate_pvpanic_pci =3D { + .name =3D "pvpanic-pci", + .version_id =3D 1, + .minimum_version_id =3D 1, + .fields =3D (VMStateField[]) { + VMSTATE_PCI_DEVICE(dev, PVPanicPCIState), + VMSTATE_END_OF_LIST() + } +}; + +static void pvpanic_pci_realizefn(PCIDevice *dev, Error **errp) +{ + PVPanicPCIState *s =3D PVPANIC_PCI_DEVICE(dev); + PVPanicState *ps =3D &s->pvpanic; + + pvpanic_setup_io(&s->pvpanic, DEVICE(s), 2); + + pci_register_bar(dev, 0, PCI_BASE_ADDRESS_SPACE_MEMORY, &ps->mr); +} + +static Property pvpanic_pci_properties[] =3D { + DEFINE_PROP_UINT8("events", PVPanicPCIState, pvpanic.events, PVPANIC_P= ANICKED | PVPANIC_CRASHLOADED), + DEFINE_PROP_END_OF_LIST(), +}; + +static void pvpanic_pci_class_init(ObjectClass *klass, void *data) +{ + DeviceClass *dc =3D DEVICE_CLASS(klass); + PCIDeviceClass *pc =3D PCI_DEVICE_CLASS(klass); + + device_class_set_props(dc, pvpanic_pci_properties); + + pc->realize =3D pvpanic_pci_realizefn; + pc->vendor_id =3D PCI_VENDOR_ID_REDHAT; + pc->device_id =3D PCI_DEVICE_ID_REDHAT_PVPANIC; + pc->revision =3D 1; + pc->class_id =3D PCI_CLASS_SYSTEM_OTHER; + dc->vmsd =3D &vmstate_pvpanic_pci; + + set_bit(DEVICE_CATEGORY_MISC, dc->categories); +} + +static TypeInfo pvpanic_pci_info =3D { + .name =3D TYPE_PVPANIC_PCI_DEVICE, + .parent =3D TYPE_PCI_DEVICE, + .instance_size =3D sizeof(PVPanicPCIState), + .class_init =3D pvpanic_pci_class_init, + .interfaces =3D (InterfaceInfo[]) { + { INTERFACE_CONVENTIONAL_PCI_DEVICE }, + { } + } +}; + +static void pvpanic_register_types(void) +{ + type_register_static(&pvpanic_pci_info); +} + +type_init(pvpanic_register_types); diff --git a/hw/misc/Kconfig b/hw/misc/Kconfig index 23bc9786cf4..19c216f3efb 100644 --- a/hw/misc/Kconfig +++ b/hw/misc/Kconfig @@ -124,6 +124,12 @@ config IOTKIT_SYSINFO config PVPANIC_COMMON bool =20 +config PVPANIC_PCI + bool + default y if PCI_DEVICES + depends on PCI + select PVPANIC_COMMON + config PVPANIC_ISA bool depends on ISA_BUS diff --git a/hw/misc/meson.build b/hw/misc/meson.build index edaaec2a3ee..629283957fc 100644 --- a/hw/misc/meson.build +++ b/hw/misc/meson.build @@ -100,6 +100,7 @@ softmmu_ss.add(when: 'CONFIG_ARMSSE_CPUID', if_true: fi= les('armsse-cpuid.c')) softmmu_ss.add(when: 'CONFIG_ARMSSE_MHU', if_true: files('armsse-mhu.c')) =20 softmmu_ss.add(when: 'CONFIG_PVPANIC_ISA', if_true: files('pvpanic-isa.c')) +softmmu_ss.add(when: 'CONFIG_PVPANIC_PCI', if_true: files('pvpanic-pci.c')) softmmu_ss.add(when: 'CONFIG_AUX', if_true: files('auxbus.c')) softmmu_ss.add(when: 'CONFIG_ASPEED_SOC', if_true: files('aspeed_scu.c', '= aspeed_sdmc.c', 'aspeed_xdma.c')) softmmu_ss.add(when: 'CONFIG_MSF2', if_true: files('msf2-sysreg.c')) --=20 2.20.1 From nobody Thu May 16 19:07:36 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1611919127; cv=none; d=zohomail.com; s=zohoarc; b=TeRZ84ghXD66fNIjVoFS+aGlgaBUAvajUFCZKQONxhk2xU/43NUNZ2tAlHGeBsiY93AgzZRaF3XtrUr36YKUAVvWuUuStp15VqKxjP+A+aJ7drVnv02qC20gyNFVas6ijrnYvNVWcBYpSSZaWCF3BUVbjDqZIo+iZCHhVsd8/iI= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1611919127; h=Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=4xSrwZi/LBTckPDqAvRCIzHfsu5xqT3tP56Jtyc9pH4=; b=AEPymphzybkboDzzkWbaJMtbiErsH72GsWiSf6ICzMst/mrDfcrM/CX9kRvXenwInKJhGmXEQ24CpslFX98CI0czuo8az1pK2JWterVzZLpv/cRn596GIRL7UAkMD4lBQCmmy4yrwqqxNvGuNtKwIUwu0zd/HENBHv554MTzAbs= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1611919127238917.4878210031212; Fri, 29 Jan 2021 03:18:47 -0800 (PST) Received: from localhost ([::1]:35012 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1l5Rna-00045c-2Y for importer@patchew.org; Fri, 29 Jan 2021 06:18:46 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:59964) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1l5RWH-0004um-BW for qemu-devel@nongnu.org; Fri, 29 Jan 2021 06:00:53 -0500 Received: from mail-wm1-x329.google.com ([2a00:1450:4864:20::329]:34318) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1l5RVz-00070W-3d for qemu-devel@nongnu.org; Fri, 29 Jan 2021 06:00:53 -0500 Received: by mail-wm1-x329.google.com with SMTP id o10so6795283wmc.1 for ; Fri, 29 Jan 2021 03:00:34 -0800 (PST) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [81.2.115.148]) by smtp.gmail.com with ESMTPSA id w20sm9268761wmm.12.2021.01.29.03.00.32 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 29 Jan 2021 03:00:32 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:subject:date:message-id:in-reply-to:references:mime-version :content-transfer-encoding; bh=4xSrwZi/LBTckPDqAvRCIzHfsu5xqT3tP56Jtyc9pH4=; b=MnhpmToQcf4DC70KBjralQqwDnb6WT8+bb3WjOXTpDGB7OkL5Q8WuhE+Q/BrFsab3L xuecy7DcjEWrQ/4OyZCBF7rLbqa7K/ow5vT3ox0vhV9AqSNvI7y+2Ue4+0inyKTXVgkw cd4doj6XAEAHoV/gVq03tf+RBtNYkAG2EraucScNHs2dgOrdC4NR85M1w8/G4VQXWval 99Z89P0W+4HimBnP0IVUtVX5jE9nJkld/tEA6w07D2X/Vx5wrEwV6UQSRizfGkP9Hje6 4LnUZZuBnFFr793VENiHlzoxUZsisZ3Tf4EsgrVb5UBs20y+NRoevf6Zpj3vHbD32u89 uQ1A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=4xSrwZi/LBTckPDqAvRCIzHfsu5xqT3tP56Jtyc9pH4=; b=qpOB09cy6IrQiFWRGmEPb0uV6h3Rd9s1OWQJgyZhghtC5JFQ7RA7MuSJeWDjTZaNig h3VDRJvCgY1pxr8OMx6GpsmztJmHXshMa7lHBU7+MlI5KQXZAo3V+e9tUIuGcqK3KobG 7eZLq2xP/ARQf4yCHgMaBaOJbJ1VvwDHJkhrERqaImgtY+lMDy+QSK2hEvy5/CTkY3io Kdd46z5FIqw8/PKUo7UbrHs7kNG9PDJOvXPLx/cSZqLp4Y0aliEwqR5pgo5Bi36wrn1d LJJbp7vXvhQVD7pUHdxWh/LhlOWaQ2eZ+enxXJnD9D9UkuSVeOif3FVMcWajaBDAPZLz Uq3w== X-Gm-Message-State: AOAM5326LW6m14HiPmX6KUKMPbXaYfXbMrfQz3oAmgNRt4QGQpNSxTx0 Cz7YatvcgqHnn97m8XYtpv6dO+IjTcnugQ== X-Google-Smtp-Source: ABdhPJyOCOK1QsLzbS7MpHSt6NqGNrOLWIujIbDq2SyZzFb+pyjeztuyJQnO7ny7+et3r2B8Qgj/Rg== X-Received: by 2002:a7b:ce17:: with SMTP id m23mr3231240wmc.178.1611918033365; Fri, 29 Jan 2021 03:00:33 -0800 (PST) From: Peter Maydell To: qemu-devel@nongnu.org Subject: [PULL 20/46] pvpanic : update pvpanic spec document Date: Fri, 29 Jan 2021 10:59:46 +0000 Message-Id: <20210129110012.8660-21-peter.maydell@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20210129110012.8660-1-peter.maydell@linaro.org> References: <20210129110012.8660-1-peter.maydell@linaro.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2a00:1450:4864:20::329; envelope-from=peter.maydell@linaro.org; helo=mail-wm1-x329.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.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @linaro.org) Content-Type: text/plain; charset="utf-8" From: Mihai Carabas Add pvpanic PCI device support details in docs/specs/pvpanic.txt. Signed-off-by: Mihai Carabas Reviewed-by: Peter Maydell Signed-off-by: Peter Maydell --- docs/specs/pvpanic.txt | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/docs/specs/pvpanic.txt b/docs/specs/pvpanic.txt index a90fbca72b7..8afcde11cc8 100644 --- a/docs/specs/pvpanic.txt +++ b/docs/specs/pvpanic.txt @@ -1,7 +1,7 @@ PVPANIC DEVICE =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D =20 -pvpanic device is a simulated ISA device, through which a guest panic +pvpanic device is a simulated device, through which a guest panic event is sent to qemu, and a QMP event is generated. This allows management apps (e.g. libvirt) to be notified and respond to the event. =20 @@ -9,6 +9,9 @@ The management app has the option of waiting for GUEST_PANI= CKED events, and/or polling for guest-panicked RunState, to learn when the pvpanic device has fired a panic event. =20 +The pvpanic device can be implemented as an ISA device (using IOPORT) or a= s a +PCI device. + ISA Interface ------------- =20 @@ -24,6 +27,14 @@ bit 1: a guest panic has happened and will be handled by= the guest; the host should record it or report it, but should not affect the execution of the guest. =20 +PCI Interface +------------- + +The PCI interface is similar to the ISA interface except that it uses an M= MIO +address space provided by its BAR0, 1 byte long. Any machine with a PCI bus +can enable a pvpanic device by adding '-device pvpanic-pci' to the command +line. + ACPI Interface -------------- =20 --=20 2.20.1 From nobody Thu May 16 19:07:36 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1611919022; cv=none; d=zohomail.com; s=zohoarc; b=DEaaTqAHo7S/WO7cSpZ6KnuwBc0luBdsha5U8Fij6BbZ5adzURXAWdtk2SNmcPNvgGM0MQ8H4+ouLOtSzCCZSyYsTvZgnZWQ04WW94dPTUo9GpQjuDvOFyt1N4+QAjOZeAffc7CJOKTHDWSzagLAKxQygwDX+WCEa+rPZYX0Cn4= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1611919022; h=Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=BoKvlH3Fhi46hE67ztwWlR+zE+on7dVPNfaSS14thSg=; b=HFghvz78AuVA37HXmKyYSFRL+SqoaJTxNmC74xroJnXhMA1GJOF/tELVeS/tMpnu1daDvVeG2F5jqy+OSl1iCH5Pma4Fn940VXJvRjoFjODyECXPBiwhFOFDFF8WIPMywUk2lnjIOlCdrLXd9BeUQVx3vFsFCUrZj+G2Df9hqWQ= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1611919022536302.74134743694435; Fri, 29 Jan 2021 03:17:02 -0800 (PST) Received: from localhost ([::1]:56890 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1l5Rls-0001XC-6B for importer@patchew.org; Fri, 29 Jan 2021 06:17:00 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:59840) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1l5RWB-0004h9-NB for qemu-devel@nongnu.org; Fri, 29 Jan 2021 06:00:47 -0500 Received: from mail-wr1-x42b.google.com ([2a00:1450:4864:20::42b]:40605) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1l5RW0-00070g-8E for qemu-devel@nongnu.org; Fri, 29 Jan 2021 06:00:47 -0500 Received: by mail-wr1-x42b.google.com with SMTP id c12so8392018wrc.7 for ; Fri, 29 Jan 2021 03:00:35 -0800 (PST) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [81.2.115.148]) by smtp.gmail.com with ESMTPSA id w20sm9268761wmm.12.2021.01.29.03.00.33 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 29 Jan 2021 03:00:33 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:subject:date:message-id:in-reply-to:references:mime-version :content-transfer-encoding; bh=BoKvlH3Fhi46hE67ztwWlR+zE+on7dVPNfaSS14thSg=; b=jKo/VjhhwdVzbZFRDLvM1njjYiXin0HD7F5x1r+oH62a2Qe3b0G117Ya41IZMEuIvf h52/1ZdkRPVSBRf7vatSWoSh+20DhtNoihndVqM23hcBMviPXVgZEnaBxM4CCaMxZ7QA 2c5wMfouUvgNPFTgm6qQFzVgehye0rvgeFmKQmsfUxTGXBompoy0Sxh6svy0FdXjpKSQ C6VS7oO3H4ohoVe3zJoY29kugHqNe17251iEKoZtzspL5MaguQldfnzq8fmd3ZSdzjJu xlw89KqZFsZU5yq7pTKIm6YO+J6jBX6fyMeGel5UmVPzZ3ut8lNDTEiM0f/K22HeXWwP nn/A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=BoKvlH3Fhi46hE67ztwWlR+zE+on7dVPNfaSS14thSg=; b=Y3d5MFlsz64fRzr6Y1qJ5TfoeDqx+FE+mk9JFPGx6XWB/412zKCyqXcDVG8iNpmzkB HlHiuqGJNaAzurPeLYWWEIu8URwW+upfTnMgYh3L4ZCO8xhesS7tkEw7z9N4ZUdMgoil 3Yq5cOl97PKd+oLjIp/apsxyk3j4F3SYDi2gh19aBcqajEWMxm61ZVmx/1D8j0t4bBKY cKee7vs9DswHBEbgIONKq6mJ8O3A6QKeRlPeRKt+al9jQXYIYBaGWjQSRiq7IvaVibfY UvAOcdXfEBnjVVJfjQeNZPWY5ZatNqCUWmbUQ5hFmbEIqdxUFOuV0RwnhaRwbPqOO7ef r3vg== X-Gm-Message-State: AOAM531CODE25NpXM6tFIPx10+mZmjLU8Sve9klkY97eO8208OwCn0ZW 762BcgtkKTBHB7VGknQayFiTnWJRXixmng== X-Google-Smtp-Source: ABdhPJyTz9cgYboCJXvedwUGkWWnkVo90eduvkZHrInIZYvVj/m09yq+396Q+BEOJgU0LQcx7aYI+Q== X-Received: by 2002:a5d:58dc:: with SMTP id o28mr3875488wrf.414.1611918034248; Fri, 29 Jan 2021 03:00:34 -0800 (PST) From: Peter Maydell To: qemu-devel@nongnu.org Subject: [PULL 21/46] tests/qtest: add a test case for pvpanic-pci Date: Fri, 29 Jan 2021 10:59:47 +0000 Message-Id: <20210129110012.8660-22-peter.maydell@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20210129110012.8660-1-peter.maydell@linaro.org> References: <20210129110012.8660-1-peter.maydell@linaro.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2a00:1450:4864:20::42b; envelope-from=peter.maydell@linaro.org; helo=mail-wr1-x42b.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.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @linaro.org) Content-Type: text/plain; charset="utf-8" From: Mihai Carabas Add a test case for pvpanic-pci device. The scenario is the same as pvpanic ISA device, but is using the PCI bus. Signed-off-by: Mihai Carabas Acked-by: Thomas Huth Reviewed-by: Peter Maydell Signed-off-by: Mihai Carabas Signed-off-by: Peter Maydell --- tests/qtest/pvpanic-pci-test.c | 94 ++++++++++++++++++++++++++++++++++ tests/qtest/meson.build | 1 + 2 files changed, 95 insertions(+) create mode 100644 tests/qtest/pvpanic-pci-test.c diff --git a/tests/qtest/pvpanic-pci-test.c b/tests/qtest/pvpanic-pci-test.c new file mode 100644 index 00000000000..24b33c64a0b --- /dev/null +++ b/tests/qtest/pvpanic-pci-test.c @@ -0,0 +1,94 @@ +/* + * QTest testcase for PV Panic PCI device + * + * Copyright (C) 2020 Oracle + * + * Authors: + * Mihai Carabas + * + * This work is licensed under the terms of the GNU GPL, version 2 or late= r. + * See the COPYING file in the top-level directory. + * + */ + +#include "qemu/osdep.h" +#include "libqos/libqtest.h" +#include "qapi/qmp/qdict.h" +#include "libqos/pci.h" +#include "libqos/pci-pc.h" +#include "hw/pci/pci_regs.h" + +static void test_panic_nopause(void) +{ + uint8_t val; + QDict *response, *data; + QTestState *qts; + QPCIBus *pcibus; + QPCIDevice *dev; + QPCIBar bar; + + qts =3D qtest_init("-device pvpanic-pci,addr=3D04.0 -action panic=3Dno= ne"); + pcibus =3D qpci_new_pc(qts, NULL); + dev =3D qpci_device_find(pcibus, QPCI_DEVFN(0x4, 0x0)); + qpci_device_enable(dev); + bar =3D qpci_iomap(dev, 0, NULL); + + qpci_memread(dev, bar, 0, &val, sizeof(val)); + g_assert_cmpuint(val, =3D=3D, 3); + + val =3D 1; + qpci_memwrite(dev, bar, 0, &val, sizeof(val)); + + response =3D qtest_qmp_eventwait_ref(qts, "GUEST_PANICKED"); + g_assert(qdict_haskey(response, "data")); + data =3D qdict_get_qdict(response, "data"); + g_assert(qdict_haskey(data, "action")); + g_assert_cmpstr(qdict_get_str(data, "action"), =3D=3D, "run"); + qobject_unref(response); + + qtest_quit(qts); +} + +static void test_panic(void) +{ + uint8_t val; + QDict *response, *data; + QTestState *qts; + QPCIBus *pcibus; + QPCIDevice *dev; + QPCIBar bar; + + qts =3D qtest_init("-device pvpanic-pci,addr=3D04.0 -action panic=3Dpa= use"); + pcibus =3D qpci_new_pc(qts, NULL); + dev =3D qpci_device_find(pcibus, QPCI_DEVFN(0x4, 0x0)); + qpci_device_enable(dev); + bar =3D qpci_iomap(dev, 0, NULL); + + qpci_memread(dev, bar, 0, &val, sizeof(val)); + g_assert_cmpuint(val, =3D=3D, 3); + + val =3D 1; + qpci_memwrite(dev, bar, 0, &val, sizeof(val)); + + response =3D qtest_qmp_eventwait_ref(qts, "GUEST_PANICKED"); + g_assert(qdict_haskey(response, "data")); + data =3D qdict_get_qdict(response, "data"); + g_assert(qdict_haskey(data, "action")); + g_assert_cmpstr(qdict_get_str(data, "action"), =3D=3D, "pause"); + qobject_unref(response); + + qtest_quit(qts); +} + +int main(int argc, char **argv) +{ + int ret; + + g_test_init(&argc, &argv, NULL); + qtest_add_func("/pvpanic-pci/panic", test_panic); + qtest_add_func("/pvpanic-pci/panic-nopause", test_panic_nopause); + + ret =3D g_test_run(); + + return ret; +} diff --git a/tests/qtest/meson.build b/tests/qtest/meson.build index 0e85343b96b..7ccdf023111 100644 --- a/tests/qtest/meson.build +++ b/tests/qtest/meson.build @@ -34,6 +34,7 @@ qtests_i386 =3D \ config_all_devices.has_key('CONFIG_ISA_IPMI_BT') ? ['ipmi-bt-test'] : [= ]) + \ (config_all_devices.has_key('CONFIG_WDT_IB700') ? ['wdt_ib700-test'] : [= ]) + \ (config_all_devices.has_key('CONFIG_PVPANIC_ISA') ? ['pvpanic-test'] : [= ]) + \ + (config_all_devices.has_key('CONFIG_PVPANIC_PCI') ? ['pvpanic-pci-test']= : []) + \ (config_all_devices.has_key('CONFIG_HDA') ? ['intel-hda-test'] : []) + = \ (config_all_devices.has_key('CONFIG_I82801B11') ? ['i82801b11-test'] : [= ]) + \ (config_all_devices.has_key('CONFIG_IOH3420') ? ['ioh3420-test'] : []) += \ --=20 2.20.1 From nobody Thu May 16 19:07:36 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1611918908; cv=none; d=zohomail.com; s=zohoarc; b=COvXJCIBiZu45CH7aKe9o3K/XjDB1UMWzjIGB+K8v9yEkHuh+hFF8zPuF8VY/clqIhS3F+E3vfwfs4PQbowA8hs05NtI3gBZN8SBVFbZPG0DVXSpD5Jj8hhDX0wUTnRJQ45jJOvRX0U4yb/HfDdXMF+xbRsNVK7/ag+trF4Guds= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1611918908; h=Content-Type:Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=Esyq17HhYoFys0+3B05acQPqcZoziSiXEoUKmC7g+48=; b=ZAR8Ai19dARu/r9WQhg5ylNR2TNrx+c5uKOSyvezgvR94C51NPeeektHlVv54j3eN4Y494fLfJU4/6TlIHfkm8N1LOxhqQda46myNLb9V3yF60FmuXLjvmMZVqbxCt6MqgtGm4h37Q07+yfXqYFkDlYKCKcmkUUcEoVf4OXo9sU= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1611918908704861.0945493749358; Fri, 29 Jan 2021 03:15:08 -0800 (PST) Received: from localhost ([::1]:52160 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1l5Rk3-00083g-ET for importer@patchew.org; Fri, 29 Jan 2021 06:15:07 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:59848) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1l5RWC-0004iC-3z for qemu-devel@nongnu.org; Fri, 29 Jan 2021 06:00:48 -0500 Received: from mail-wr1-x42c.google.com ([2a00:1450:4864:20::42c]:33005) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1l5RW0-00071G-BQ for qemu-devel@nongnu.org; Fri, 29 Jan 2021 06:00:47 -0500 Received: by mail-wr1-x42c.google.com with SMTP id 7so8419168wrz.0 for ; Fri, 29 Jan 2021 03:00:35 -0800 (PST) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [81.2.115.148]) by smtp.gmail.com with ESMTPSA id w20sm9268761wmm.12.2021.01.29.03.00.34 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 29 Jan 2021 03:00:34 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:subject:date:message-id:in-reply-to:references:mime-version :content-transfer-encoding; bh=Esyq17HhYoFys0+3B05acQPqcZoziSiXEoUKmC7g+48=; b=ppfE9jGUMHi3cRnWGEcM7KxG2Y8Gopy+HcUlN/vYYVPA/t1n/0WPFxGp/zVmPATFBU C0txOn2kl4iXb7gr677/Ej5s2kM0qhRLlrg3pRgG7cPauMDMyjT0Qd0p0dKq2V9ilRgK cSJK+XOV1VrMolrUimmloF15dlM6+QJXPbGuUWDYGSEc2Z/AnggWlDqafoKEY6ICq5Nw iISNT3ZhkBXn9oxOGZhMy7Bt5djOuq3eWlqhi6PbGRn1BHuE8GEGfAYi7om41SM49+8T SkZjD7D+TgriC/RBy4mvxOvV+G5xjAxyaIoxGt6dRvxV2B7MvdJkAgjRGH21WQGPWIgi p/3A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=Esyq17HhYoFys0+3B05acQPqcZoziSiXEoUKmC7g+48=; b=DI8Az8TgrLIj3bY2hmSnh8QsmodLqoF3s4NyoYVd+73tUqooIIhSNKd50fqQtE1FJU FtK3SJvyMNw81Swwsp8UxRl2bBuFNJId5tiNzU5NsC9om4QQXdwCRf3c+91Kf5MdpzBO QXL4JDkK1y3kbdlPhfRGlSvIiqg6IWA8v7n+ohidLuAuMoOCze7fIbr3d/nxlUHtnp5q jNKH2d+0d3lTOyPjXt9ieitx5OK7BonGZjQkMeduthc4iqrs5REQp3ocXoPaITTfVnpR Bdvd35mKQ313d42Aor3TJ9B7XbBMBXMr5LT3Rrqv7ayWPi7vqqq/yM+rS55mdCOXeEiQ jqmA== X-Gm-Message-State: AOAM532IzK6od7fWm9zJE+fo0/L2YXKV0JlktIUScjr81SqUfQpjrWKo JfT/T3HqYlwogpJaoCIDgp5qZo25rG30zw== X-Google-Smtp-Source: ABdhPJwmBViZZ5RaIGYC2giIIr8afiGIsrPSXdyxKEj6YuHFwQIirZXP4BwrQ20rkDfqNiXM7MMX7g== X-Received: by 2002:adf:df12:: with SMTP id y18mr3929750wrl.141.1611918035157; Fri, 29 Jan 2021 03:00:35 -0800 (PST) From: Peter Maydell To: qemu-devel@nongnu.org Subject: [PULL 22/46] ptimer: Add new ptimer_set_period_from_clock() function Date: Fri, 29 Jan 2021 10:59:48 +0000 Message-Id: <20210129110012.8660-23-peter.maydell@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20210129110012.8660-1-peter.maydell@linaro.org> References: <20210129110012.8660-1-peter.maydell@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2a00:1450:4864:20::42c; envelope-from=peter.maydell@linaro.org; helo=mail-wr1-x42c.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.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @linaro.org) The ptimer API currently provides two methods for setting the period: ptimer_set_period(), which takes a period in nanoseconds, and ptimer_set_freq(), which takes a frequency in Hz. Neither of these lines up nicely with the Clock API, because although both the Clock and the ptimer track the frequency using a representation of whole and fractional nanoseconds, conversion via either period-in-ns or frequency-in-Hz will introduce a rounding error. Add a new function ptimer_set_period_from_clock() which takes the Clock object directly to avoid the rounding issues. This includes a facility for the user to specify that there is a frequency divider between the Clock proper and the timer, as some timer devices like the CMSDK APB dualtimer need this. To avoid having to drag in clock.h from ptimer.h we add the Clock type to typedefs.h. Signed-off-by: Peter Maydell Reviewed-by: Luc Michel Tested-by: Philippe Mathieu-Daud=C3=A9 Reviewed-by: Philippe Mathieu-Daud=C3=A9 Message-id: 20210128114145.20536-2-peter.maydell@linaro.org Message-id: 20210121190622.22000-2-peter.maydell@linaro.org --- include/hw/ptimer.h | 22 ++++++++++++++++++++++ include/qemu/typedefs.h | 1 + hw/core/ptimer.c | 34 ++++++++++++++++++++++++++++++++++ 3 files changed, 57 insertions(+) diff --git a/include/hw/ptimer.h b/include/hw/ptimer.h index 412763fffb2..c443218475b 100644 --- a/include/hw/ptimer.h +++ b/include/hw/ptimer.h @@ -165,6 +165,28 @@ void ptimer_transaction_commit(ptimer_state *s); */ void ptimer_set_period(ptimer_state *s, int64_t period); =20 +/** + * ptimer_set_period_from_clock - Set counter increment from a Clock + * @s: ptimer to configure + * @clk: pointer to Clock object to take period from + * @divisor: value to scale the clock frequency down by + * + * If the ptimer is being driven from a Clock, this is the preferred + * way to tell the ptimer about the period, because it avoids any + * possible rounding errors that might happen if the internal + * representation of the Clock period was converted to either a period + * in ns or a frequency in Hz. + * + * If the ptimer should run at the same frequency as the clock, + * pass 1 as the @divisor; if the ptimer should run at half the + * frequency, pass 2, and so on. + * + * This function will assert if it is called outside a + * ptimer_transaction_begin/commit block. + */ +void ptimer_set_period_from_clock(ptimer_state *s, const Clock *clock, + unsigned int divisor); + /** * ptimer_set_freq - Set counter frequency in Hz * @s: ptimer to configure diff --git a/include/qemu/typedefs.h b/include/qemu/typedefs.h index 976b529dfb5..68deb74ef6f 100644 --- a/include/qemu/typedefs.h +++ b/include/qemu/typedefs.h @@ -34,6 +34,7 @@ typedef struct BlockDriverState BlockDriverState; typedef struct BusClass BusClass; typedef struct BusState BusState; typedef struct Chardev Chardev; +typedef struct Clock Clock; typedef struct CompatProperty CompatProperty; typedef struct CoMutex CoMutex; typedef struct CPUAddressSpace CPUAddressSpace; diff --git a/hw/core/ptimer.c b/hw/core/ptimer.c index 2aa97cb665c..6ba19fd9658 100644 --- a/hw/core/ptimer.c +++ b/hw/core/ptimer.c @@ -15,6 +15,7 @@ #include "sysemu/qtest.h" #include "block/aio.h" #include "sysemu/cpus.h" +#include "hw/clock.h" =20 #define DELTA_ADJUST 1 #define DELTA_NO_ADJUST -1 @@ -348,6 +349,39 @@ void ptimer_set_period(ptimer_state *s, int64_t period) } } =20 +/* Set counter increment interval from a Clock */ +void ptimer_set_period_from_clock(ptimer_state *s, const Clock *clk, + unsigned int divisor) +{ + /* + * The raw clock period is a 64-bit value in units of 2^-32 ns; + * put another way it's a 32.32 fixed-point ns value. Our internal + * representation of the period is 64.32 fixed point ns, so + * the conversion is simple. + */ + uint64_t raw_period =3D clock_get(clk); + uint64_t period_frac; + + assert(s->in_transaction); + s->delta =3D ptimer_get_count(s); + s->period =3D extract64(raw_period, 32, 32); + period_frac =3D extract64(raw_period, 0, 32); + /* + * divisor specifies a possible frequency divisor between the + * clock and the timer, so it is a multiplier on the period. + * We do the multiply after splitting the raw period out into + * period and frac to avoid having to do a 32*64->96 multiply. + */ + s->period *=3D divisor; + period_frac *=3D divisor; + s->period +=3D extract64(period_frac, 32, 32); + s->period_frac =3D (uint32_t)period_frac; + + if (s->enabled) { + s->need_reload =3D true; + } +} + /* Set counter frequency in Hz. */ void ptimer_set_freq(ptimer_state *s, uint32_t freq) { --=20 2.20.1 From nobody Thu May 16 19:07:36 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1611919020; cv=none; d=zohomail.com; s=zohoarc; b=ntoOi7LD/rX19diaapFSkRhrgu3ctNQnTBrSyWS93F+YT2avDUCV8qwKAXqKxrB7+Q37FilrgzY84A5K4KkIi/wL8rm0Vc32StS2AY0RABKdFZkI8b3spX6k1LrqPVfMQ5mBZj413mehMq1Ya977EjVT7qw1ajPWRqEVv/xBPZk= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1611919020; h=Content-Type:Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=iwK74lUuICgESOvqT1mx3LAnqkaSE1TGL5QtPXgrPPg=; b=lzGWTLULVFRSzA5qPH8rtH5aMMMd7DvyuKaNQI8pfxmGhiHL2qiSpNt5eP+ze4ec/I89fdcXgwaeLei5mofapggLr7VP57Sc5fLmErSJjxFtpob6gwvhMx3yOCK4iiIIiBuefOGP28OXh1xRt5D11xbSl473vPfYyWrV/Oo5ZUI= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1611919020716834.7731222587017; Fri, 29 Jan 2021 03:17:00 -0800 (PST) Received: from localhost ([::1]:56850 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1l5Rlr-0001WF-Km for importer@patchew.org; Fri, 29 Jan 2021 06:16:59 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:59886) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1l5RWD-0004mQ-Tv for qemu-devel@nongnu.org; Fri, 29 Jan 2021 06:00:49 -0500 Received: from mail-wr1-x436.google.com ([2a00:1450:4864:20::436]:36770) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1l5RW1-00072Z-6L for qemu-devel@nongnu.org; Fri, 29 Jan 2021 06:00:49 -0500 Received: by mail-wr1-x436.google.com with SMTP id 6so8390504wri.3 for ; Fri, 29 Jan 2021 03:00:36 -0800 (PST) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [81.2.115.148]) by smtp.gmail.com with ESMTPSA id w20sm9268761wmm.12.2021.01.29.03.00.35 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 29 Jan 2021 03:00:35 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:subject:date:message-id:in-reply-to:references:mime-version :content-transfer-encoding; bh=iwK74lUuICgESOvqT1mx3LAnqkaSE1TGL5QtPXgrPPg=; b=U13BeTUygQH1XUvVHKP2dVtmcBwprYNBphmRFkmWXNHQJ/+cgbrS02dhqM02nER1aC Fx5ELd1zxFTEF86SjQ24iDktV+/9n9h+a1fgP10AcNy15hutD4EF1FjithCskA1sEu2V 9/cDmOvghJwFACXolCishdhh4JQ7ImhQagYZEaNdnBMqm8Bc0DPiCj5l+pusSwUcWrJD /q2YrXWygRHGocmZhaAPlX5Oiroh/nN3X3zIJiEAfccrcDcy6udHVn1+kagZd5iKdUHa 9SgrJ/7EXudk5JMK7vF8s/3l1h5ieidkBrRPHs43QbatogYHlMXRm9J9C7nWQXcqOqOL 3rwQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=iwK74lUuICgESOvqT1mx3LAnqkaSE1TGL5QtPXgrPPg=; b=hnC7hqPiVytfl6qCwqDqIIRGIz2ix6DVo4oCTfnGDUKl/Oc4UU6bdgNtdHGQMnrG39 dmCWRPb14sKKrgXh7liZBkj7T71a17siVkPhoFkPMl8sSmGKKD+Vs50sRQV/2ebmxexX Q9Vb13YXZQtvIj1jmHg+tqVO7x5m4jejHvltvfoKg3GkfZhN2X4mK+k8vN6SvhOjbSJo zoWr762aGzq0Lm+vqEWvaap/nkWc/UxrFQ6Lv0ipUDn3YckHr5aKwz3Coa3HLAr+Wwbz UR55QVv2EjvG9pEb4tufpaijIjv1MgC4symauZseIGAXPCzCRwqvYQdBj4vYZMc1hWVk ky5g== X-Gm-Message-State: AOAM532uxryEpSua8HkFAt+A61LDLknchYN4YrHHUhn1T43jCzkVYc5I YIN3Js3PdcXPvD1Ue2GK7FBEScAqFcWkng== X-Google-Smtp-Source: ABdhPJw7z6tbK5vBfiWW8DsxuF0PpjyAotORFNwiLQK9Uz0RiZY3N8wD6ZSYdzMLlFhWlsCvJHcihQ== X-Received: by 2002:a05:6000:1105:: with SMTP id z5mr3875424wrw.15.1611918035941; Fri, 29 Jan 2021 03:00:35 -0800 (PST) From: Peter Maydell To: qemu-devel@nongnu.org Subject: [PULL 23/46] clock: Add new clock_has_source() function Date: Fri, 29 Jan 2021 10:59:49 +0000 Message-Id: <20210129110012.8660-24-peter.maydell@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20210129110012.8660-1-peter.maydell@linaro.org> References: <20210129110012.8660-1-peter.maydell@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2a00:1450:4864:20::436; envelope-from=peter.maydell@linaro.org; helo=mail-wr1-x436.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.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @linaro.org) Add a function for checking whether a clock has a source. This is useful for devices which have input clocks that must be wired up by the board as it allows them to fail in realize rather than ploughing on with a zero-period clock. Signed-off-by: Peter Maydell Reviewed-by: Luc Michel Reviewed-by: Philippe Mathieu-Daud=C3=A9 Tested-by: Philippe Mathieu-Daud=C3=A9 Message-id: 20210128114145.20536-3-peter.maydell@linaro.org Message-id: 20210121190622.22000-3-peter.maydell@linaro.org --- docs/devel/clocks.rst | 16 ++++++++++++++++ include/hw/clock.h | 15 +++++++++++++++ 2 files changed, 31 insertions(+) diff --git a/docs/devel/clocks.rst b/docs/devel/clocks.rst index 2548d842322..c54bbb82409 100644 --- a/docs/devel/clocks.rst +++ b/docs/devel/clocks.rst @@ -235,6 +235,22 @@ object during device instance init. For example: /* set initial value to 10ns / 100MHz */ clock_set_ns(clk, 10); =20 +To enforce that the clock is wired up by the board code, you can +call ``clock_has_source()`` in your device's realize method: + +.. code-block:: c + + if (!clock_has_source(s->clk)) { + error_setg(errp, "MyDevice: clk input must be connected"); + return; + } + +Note that this only checks that the clock has been wired up; it is +still possible that the output clock connected to it is disabled +or has not yet been configured, in which case the period will be +zero. You should use the clock callback to find out when the clock +period changes. + Fetching clock frequency/period ------------------------------- =20 diff --git a/include/hw/clock.h b/include/hw/clock.h index 6382f346569..e5f45e2626d 100644 --- a/include/hw/clock.h +++ b/include/hw/clock.h @@ -139,6 +139,21 @@ void clock_clear_callback(Clock *clk); */ void clock_set_source(Clock *clk, Clock *src); =20 +/** + * clock_has_source: + * @clk: the clock + * + * Returns true if the clock has a source clock connected to it. + * This is useful for devices which have input clocks which must + * be connected by the board/SoC code which creates them. The + * device code can use this to check in its realize method that + * the clock has been connected. + */ +static inline bool clock_has_source(const Clock *clk) +{ + return clk->source !=3D NULL; +} + /** * clock_set: * @clk: the clock to initialize. --=20 2.20.1 From nobody Thu May 16 19:07:36 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1611918818; cv=none; d=zohomail.com; s=zohoarc; b=nphiEonli/9rC9pj9Ux4dviiqFFWgyCrJCrl6v+oKlKOciuXwwV0pdtlSyP9n8EkY+FIEZMgykVxq4e5rQ9uzt4nhA4ZOmKdlR9zmnC3v/ISpeJzW6hpnE0bpckGw+Yw4zBBWcrcUYLsmWb6F9K7F2Cs57moGHyHmBxMuvh5wcE= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1611918818; h=Content-Type:Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=MCCaWFI+j7JlvEyhytVNLIBFfTW5yIMU/qhYUdn+kH4=; b=OR9Eaqf1fkUd7cHrMXFyhJ7jFTZV0DIdWEO42uMy2kOOVKLfCzl8hnBvpdMVeMhX7kQUCC1sS/6alsxTYr+0aCPkHBR0g2ddw4nhvG+bTTzoKpEkFIhmxhJufiPEaJzzyERqGXha2yV7Bl60BJPSEJ5bftqEJoLQQNRgU6rHG5Q= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1611918818523404.1876556336043; Fri, 29 Jan 2021 03:13:38 -0800 (PST) Received: from localhost ([::1]:48596 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1l5Rib-0006as-7L for importer@patchew.org; Fri, 29 Jan 2021 06:13:37 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:59878) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1l5RWD-0004lp-Hn for qemu-devel@nongnu.org; Fri, 29 Jan 2021 06:00:49 -0500 Received: from mail-wr1-x429.google.com ([2a00:1450:4864:20::429]:36758) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1l5RW2-00072j-4t for qemu-devel@nongnu.org; Fri, 29 Jan 2021 06:00:49 -0500 Received: by mail-wr1-x429.google.com with SMTP id 6so8390551wri.3 for ; Fri, 29 Jan 2021 03:00:37 -0800 (PST) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [81.2.115.148]) by smtp.gmail.com with ESMTPSA id w20sm9268761wmm.12.2021.01.29.03.00.36 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 29 Jan 2021 03:00:36 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:subject:date:message-id:in-reply-to:references:mime-version :content-transfer-encoding; bh=MCCaWFI+j7JlvEyhytVNLIBFfTW5yIMU/qhYUdn+kH4=; b=CDvYgJM9qi6DjNa5spwl7ekTGefsOr3Lle18FKy/7ckimlek7WUEJTNgqbylqfVte5 8f9hsKhHw9BUVcoHRNxsmd7vuu4XY6ccgn5TdUS1IInNuVjIT0cKC+LVIGx5eW6DBd2z DfvyzOWPhjbHdU6PgGexDPGfeSDQlB6ZMbVwcTypxB8rKG2uBsNbhfwVSoMp8izNwnNX 0NbGt/XodtHQS+vpiVPaadXc6boCFQxdBFTuoxJuJTdF0lHWXGjTFxTLp8StG1Eat3uc JH/tieXd+T6+8H7pSUPWLZoRzKooXk4Q89eu8VTBiAoXvxPkY7haYyElv29N1hXsDn5J RiLg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=MCCaWFI+j7JlvEyhytVNLIBFfTW5yIMU/qhYUdn+kH4=; b=uS661zj9b9+NH3BzMj3hhQfaUfMVSpNjLYuhBOwXUMrlJ4qKZDKF7B8tQvIKGYgFSt 4pJAbU5uQk+usbPMNbGsNF9DqkFCTgi982M46uxNQkxEYF7HGK0Paj4YSqEMOxsmiwtt YYuITB5Ime8e/Ekq6BoTq1IvXOZwfbMX6iOy5tRpd1FXUZ9Fbsm5tdlw8jsJlnpz7X7E cKCoUXqF/XIW+CeB6ghzCR1t8tkwbIEs43S30nt4oi0DdXPYnQMb/4mnYay9rv0a96K2 h+vGxvaJqHWjvYBl66mBktguamRwXwDQEn6ngJRNbHnHm8nfA9CywBzxZxanClrExPVK /6nA== X-Gm-Message-State: AOAM532Ky+bjfEgUawpJaeaJ4wfq8XSNvjBSHdlQ42t9XrGX329Jgk1w eiTy6tZS+qSblmHtzAPCOsUTaeWKW/BTeA== X-Google-Smtp-Source: ABdhPJzLcKGPpysbEAKZpSxUWCPw80ZEzlrH0D0fB9RBCnq6pwNyDeB2aHXAtP56uqcifMDjmRebDQ== X-Received: by 2002:adf:e80f:: with SMTP id o15mr3874289wrm.366.1611918036811; Fri, 29 Jan 2021 03:00:36 -0800 (PST) From: Peter Maydell To: qemu-devel@nongnu.org Subject: [PULL 24/46] tests: Add a simple test of the CMSDK APB timer Date: Fri, 29 Jan 2021 10:59:50 +0000 Message-Id: <20210129110012.8660-25-peter.maydell@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20210129110012.8660-1-peter.maydell@linaro.org> References: <20210129110012.8660-1-peter.maydell@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2a00:1450:4864:20::429; envelope-from=peter.maydell@linaro.org; helo=mail-wr1-x429.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.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @linaro.org) Add a simple test of the CMSDK APB timer, since we're about to do some refactoring of how it is clocked. Signed-off-by: Peter Maydell Reviewed-by: Philippe Mathieu-Daud=C3=A9 Reviewed-by: Luc Michel Tested-by: Philippe Mathieu-Daud=C3=A9 Message-id: 20210128114145.20536-4-peter.maydell@linaro.org Message-id: 20210121190622.22000-4-peter.maydell@linaro.org --- tests/qtest/cmsdk-apb-timer-test.c | 75 ++++++++++++++++++++++++++++++ MAINTAINERS | 1 + tests/qtest/meson.build | 1 + 3 files changed, 77 insertions(+) create mode 100644 tests/qtest/cmsdk-apb-timer-test.c diff --git a/tests/qtest/cmsdk-apb-timer-test.c b/tests/qtest/cmsdk-apb-tim= er-test.c new file mode 100644 index 00000000000..e85e1f7448e --- /dev/null +++ b/tests/qtest/cmsdk-apb-timer-test.c @@ -0,0 +1,75 @@ +/* + * QTest testcase for the CMSDK APB timer device + * + * Copyright (c) 2021 Linaro Limited + * + * This program is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License as published by the + * Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, but WIT= HOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * for more details. + */ + +#include "qemu/osdep.h" +#include "libqtest-single.h" + +/* IoTKit/ARMSSE-200 timer0; driven at 25MHz in mps2-an385, so 40ns per ti= ck */ +#define TIMER_BASE 0x40000000 + +#define CTRL 0 +#define VALUE 4 +#define RELOAD 8 +#define INTSTATUS 0xc + +static void test_timer(void) +{ + g_assert_true(readl(TIMER_BASE + INTSTATUS) =3D=3D 0); + + /* Start timer: will fire after 40 * 1000 =3D=3D 40000 ns */ + writel(TIMER_BASE + RELOAD, 1000); + writel(TIMER_BASE + CTRL, 9); + + /* Step to just past the 500th tick and check VALUE */ + clock_step(40 * 500 + 1); + g_assert_cmpuint(readl(TIMER_BASE + INTSTATUS), =3D=3D, 0); + g_assert_cmpuint(readl(TIMER_BASE + VALUE), =3D=3D, 500); + + /* Just past the 1000th tick: timer should have fired */ + clock_step(40 * 500); + g_assert_cmpuint(readl(TIMER_BASE + INTSTATUS), =3D=3D, 1); + g_assert_cmpuint(readl(TIMER_BASE + VALUE), =3D=3D, 0); + + /* VALUE reloads at the following tick */ + clock_step(40); + g_assert_cmpuint(readl(TIMER_BASE + VALUE), =3D=3D, 1000); + + /* Check write-1-to-clear behaviour of INTSTATUS */ + writel(TIMER_BASE + INTSTATUS, 0); + g_assert_cmpuint(readl(TIMER_BASE + INTSTATUS), =3D=3D, 1); + writel(TIMER_BASE + INTSTATUS, 1); + g_assert_cmpuint(readl(TIMER_BASE + INTSTATUS), =3D=3D, 0); + + /* Turn off the timer */ + writel(TIMER_BASE + CTRL, 0); +} + +int main(int argc, char **argv) +{ + int r; + + g_test_init(&argc, &argv, NULL); + + qtest_start("-machine mps2-an385"); + + qtest_add_func("/cmsdk-apb-timer/timer", test_timer); + + r =3D g_test_run(); + + qtest_end(); + + return r; +} diff --git a/MAINTAINERS b/MAINTAINERS index 34359a99b8e..6c15f7db317 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -581,6 +581,7 @@ F: include/hw/rtc/pl031.h F: include/hw/arm/primecell.h F: hw/timer/cmsdk-apb-timer.c F: include/hw/timer/cmsdk-apb-timer.h +F: tests/qtest/cmsdk-apb-timer-test.c F: hw/timer/cmsdk-apb-dualtimer.c F: include/hw/timer/cmsdk-apb-dualtimer.h F: hw/char/cmsdk-apb-uart.c diff --git a/tests/qtest/meson.build b/tests/qtest/meson.build index 7ccdf023111..519a40d5b82 100644 --- a/tests/qtest/meson.build +++ b/tests/qtest/meson.build @@ -142,6 +142,7 @@ qtests_npcm7xx =3D \ 'npcm7xx_timer-test', 'npcm7xx_watchdog_timer-test'] qtests_arm =3D \ + (config_all_devices.has_key('CONFIG_CMSDK_APB_TIMER') ? ['cmsdk-apb-time= r-test'] : []) + \ (config_all_devices.has_key('CONFIG_PFLASH_CFI02') ? ['pflash-cfi02-test= '] : []) + \ (config_all_devices.has_key('CONFIG_NPCM7XX') ? qtests_npcm7xx : []) + \ ['arm-cpu-features', --=20 2.20.1 From nobody Thu May 16 19:07:36 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1611919063; cv=none; d=zohomail.com; s=zohoarc; b=LCfmINaGQ7+5mNhgxw7sf/vqHq+YSjQvNaVirOwV1RrXRo76JH/PHOUI12y4C9CqRdwpCrepuFWkXLZxcNOsoieCQp8y4Xs0zlVGtsMxDO9YqfxxTlCAfq61JH0dMV2jIMvwO5jnro67dH3+G2KWLj/7vfJgjC1Q+BEP1984slk= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1611919063; h=Content-Type:Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=nplRZ0mA6SSMDFMU5PGJhWszXu30YiUjDAjM91AQhkA=; b=AgY9oRY23UGy3+HkREf/1YGwLDjJE9ODhcZZMlpt00KH+Qi8Om0c+QsYiB3M5rNE6d5JnHXag/UvLiTJVi1BRDTW5NMBnlpaIx0g/+Jzypc0/JogJ1gnhv9mAYJRU9abcszBQAw+q49cpUQkXJcVrbAJXrXxRgOEW2/S1vLhrNE= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1611919063103220.35579170037113; Fri, 29 Jan 2021 03:17:43 -0800 (PST) Received: from localhost ([::1]:59494 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1l5RmY-0002aa-0h for importer@patchew.org; Fri, 29 Jan 2021 06:17:42 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:59924) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1l5RWF-0004qn-Pn for qemu-devel@nongnu.org; Fri, 29 Jan 2021 06:00:51 -0500 Received: from mail-wm1-x32c.google.com ([2a00:1450:4864:20::32c]:52192) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1l5RW3-00073V-2z for qemu-devel@nongnu.org; Fri, 29 Jan 2021 06:00:51 -0500 Received: by mail-wm1-x32c.google.com with SMTP id m2so6510838wmm.1 for ; Fri, 29 Jan 2021 03:00:38 -0800 (PST) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [81.2.115.148]) by smtp.gmail.com with ESMTPSA id w20sm9268761wmm.12.2021.01.29.03.00.36 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 29 Jan 2021 03:00:37 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:subject:date:message-id:in-reply-to:references:mime-version :content-transfer-encoding; bh=nplRZ0mA6SSMDFMU5PGJhWszXu30YiUjDAjM91AQhkA=; b=swBOAMvKaFzZos3fbUiUs/muhiKGRDc0CATH0v00uROW8po+LbhPQy139YsBrzoyoe 0RPGQVcCCbne8qsQxdk41tb2YfkFQ5dAtrN5Sz6D9lZ6aFsgcSN72CByJm0S52LpmB/s 5GIoxiHuW4EJGzqOBrMI6jIGjsunek5HEqfUvTxCedEmPmGvmjTPN/Qks7oyl5LFDGl3 ZUU/TXpE8LC0E8Q77BDqV0qGPHwEHoFd/yk67Z5aCO5LLvmLr8oUd5VzA22Xy/kfcNEa bNDFCrkHZCnGsv6jW7w+IOzcD6edlzDjUKwKTNbX4mi+OcNUPuYhSg+puDBOokFcHq30 7PMA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=nplRZ0mA6SSMDFMU5PGJhWszXu30YiUjDAjM91AQhkA=; b=fskpE0mCHtLRHH1Tt8J3xCpS+CMlG9z2P8jSdfSziR+LngNFXCzeIw6ieAY2oQJdgD +R93zVmEqZrrmp286MrbitsMR062pHQ376jRW5yf3Yh3WroL2C3I7uvtBJQWSCfl2r9Y R21RmTZoIDrSsRj2x3UHpTCVkxYWn9+/2Hqbg/rOlR0ovMmf3H0GCztAo6ZAHXRPSwzp BmfBdEuT5mzTDoUvIBTC1AxjV+OpMofxOwSzlHLYt8Odqa9nkKxEww3by5MqIcT6E9vJ XhJin30bUK33gUUV789y7IToFKz6cd+2+vxpwQgu2Av+XWaBmyvo5Ng9PYDtp6t0hHlu RGEg== X-Gm-Message-State: AOAM532hzH2RIMTkdJdspBTfi/wCbIRz5JRmTmFPZIrMSIlYoyyle4Od oHudeAE8BzwwKBVay3mSqW/lVeFdRZonbQ== X-Google-Smtp-Source: ABdhPJzAzJPdBH0u9X7awdGmU+cO35G7YPG7JdGAB9tuDvlJwomBf/SIx4dTIgjN0baqokej27ZT2A== X-Received: by 2002:a1c:7402:: with SMTP id p2mr3203865wmc.43.1611918037753; Fri, 29 Jan 2021 03:00:37 -0800 (PST) From: Peter Maydell To: qemu-devel@nongnu.org Subject: [PULL 25/46] tests: Add a simple test of the CMSDK APB watchdog Date: Fri, 29 Jan 2021 10:59:51 +0000 Message-Id: <20210129110012.8660-26-peter.maydell@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20210129110012.8660-1-peter.maydell@linaro.org> References: <20210129110012.8660-1-peter.maydell@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2a00:1450:4864:20::32c; envelope-from=peter.maydell@linaro.org; helo=mail-wm1-x32c.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.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @linaro.org) Add a simple test of the CMSDK watchdog, since we're about to do some refactoring of how it is clocked. Signed-off-by: Peter Maydell Reviewed-by: Luc Michel Tested-by: Philippe Mathieu-Daud=C3=A9 Reviewed-by: Philippe Mathieu-Daud=C3=A9 Message-id: 20210128114145.20536-5-peter.maydell@linaro.org Message-id: 20210121190622.22000-5-peter.maydell@linaro.org Reviewed-by: Philippe Mathieu-Daud=C3=A9 --- tests/qtest/cmsdk-apb-watchdog-test.c | 79 +++++++++++++++++++++++++++ MAINTAINERS | 1 + tests/qtest/meson.build | 1 + 3 files changed, 81 insertions(+) create mode 100644 tests/qtest/cmsdk-apb-watchdog-test.c diff --git a/tests/qtest/cmsdk-apb-watchdog-test.c b/tests/qtest/cmsdk-apb-= watchdog-test.c new file mode 100644 index 00000000000..950f64c527b --- /dev/null +++ b/tests/qtest/cmsdk-apb-watchdog-test.c @@ -0,0 +1,79 @@ +/* + * QTest testcase for the CMSDK APB watchdog device + * + * Copyright (c) 2021 Linaro Limited + * + * This program is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License as published by the + * Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, but WIT= HOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * for more details. + */ + +#include "qemu/osdep.h" +#include "libqtest-single.h" + +/* + * lm3s811evb watchdog; at board startup this runs at 200MHz / 16 =3D=3D 1= 2.5MHz, + * which is 80ns per tick. + */ +#define WDOG_BASE 0x40000000 + +#define WDOGLOAD 0 +#define WDOGVALUE 4 +#define WDOGCONTROL 8 +#define WDOGINTCLR 0xc +#define WDOGRIS 0x10 +#define WDOGMIS 0x14 +#define WDOGLOCK 0xc00 + +static void test_watchdog(void) +{ + g_assert_cmpuint(readl(WDOG_BASE + WDOGRIS), =3D=3D, 0); + + writel(WDOG_BASE + WDOGCONTROL, 1); + writel(WDOG_BASE + WDOGLOAD, 1000); + + /* Step to just past the 500th tick */ + clock_step(500 * 80 + 1); + g_assert_cmpuint(readl(WDOG_BASE + WDOGRIS), =3D=3D, 0); + g_assert_cmpuint(readl(WDOG_BASE + WDOGVALUE), =3D=3D, 500); + + /* Just past the 1000th tick: timer should have fired */ + clock_step(500 * 80); + g_assert_cmpuint(readl(WDOG_BASE + WDOGRIS), =3D=3D, 1); + g_assert_cmpuint(readl(WDOG_BASE + WDOGVALUE), =3D=3D, 0); + + /* VALUE reloads at following tick */ + clock_step(80); + g_assert_cmpuint(readl(WDOG_BASE + WDOGVALUE), =3D=3D, 1000); + + /* Writing any value to WDOGINTCLR clears the interrupt and reloads */ + clock_step(500 * 80); + g_assert_cmpuint(readl(WDOG_BASE + WDOGVALUE), =3D=3D, 500); + g_assert_cmpuint(readl(WDOG_BASE + WDOGRIS), =3D=3D, 1); + writel(WDOG_BASE + WDOGINTCLR, 0); + g_assert_cmpuint(readl(WDOG_BASE + WDOGVALUE), =3D=3D, 1000); + g_assert_cmpuint(readl(WDOG_BASE + WDOGRIS), =3D=3D, 0); +} + +int main(int argc, char **argv) +{ + int r; + + g_test_init(&argc, &argv, NULL); + + qtest_start("-machine lm3s811evb"); + + qtest_add_func("/cmsdk-apb-watchdog/watchdog", test_watchdog); + + r =3D g_test_run(); + + qtest_end(); + + return r; +} diff --git a/MAINTAINERS b/MAINTAINERS index 6c15f7db317..3729b89f359 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -588,6 +588,7 @@ F: hw/char/cmsdk-apb-uart.c F: include/hw/char/cmsdk-apb-uart.h F: hw/watchdog/cmsdk-apb-watchdog.c F: include/hw/watchdog/cmsdk-apb-watchdog.h +F: tests/qtest/cmsdk-apb-watchdog-test.c F: hw/misc/tz-ppc.c F: include/hw/misc/tz-ppc.h F: hw/misc/tz-mpc.c diff --git a/tests/qtest/meson.build b/tests/qtest/meson.build index 519a40d5b82..5b10bfbcfb0 100644 --- a/tests/qtest/meson.build +++ b/tests/qtest/meson.build @@ -143,6 +143,7 @@ qtests_npcm7xx =3D \ 'npcm7xx_watchdog_timer-test'] qtests_arm =3D \ (config_all_devices.has_key('CONFIG_CMSDK_APB_TIMER') ? ['cmsdk-apb-time= r-test'] : []) + \ + (config_all_devices.has_key('CONFIG_CMSDK_APB_WATCHDOG') ? ['cmsdk-apb-w= atchdog-test'] : []) + \ (config_all_devices.has_key('CONFIG_PFLASH_CFI02') ? ['pflash-cfi02-test= '] : []) + \ (config_all_devices.has_key('CONFIG_NPCM7XX') ? qtests_npcm7xx : []) + \ ['arm-cpu-features', --=20 2.20.1 From nobody Thu May 16 19:07:36 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1611918709; cv=none; d=zohomail.com; s=zohoarc; b=aX+IaWkzIORN4iRUgAY/E3LUc8hPvBnm1iEr1zhiG/Qzzd1AF5ELcufsrV7ERdgpQcGb4e6GyopFY9FQ2dADtGhQZn8QlULRhRy+C5D6vPflZeZbfFEW+UQuaUVvzu/qg9SdDhBh3TzkXJK4JLFfJmuXla3BpD+WLvHDwM/wWxc= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1611918709; h=Content-Type:Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=VDHZCdr7wAWmLu1nBxqmNWwzakTz8BqCkNP46PFd2yA=; b=bGpe9bu6SCI9R9c4PsOLjkcg4vDeFvEPGeo/7h6AQ+nmkQFIHGg+cNdSiwodvr8TdbW6fnutjvs71dORlD/+1FVbq6tVNP3zSdK//ZEfvL8RmSHS1GUnyFe5YDBzu3xpOr12yGHLm+w5au7w+JP3jO2uPooBrqKxpQ4bNYCb3gU= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 161191870951588.43235799986053; Fri, 29 Jan 2021 03:11:49 -0800 (PST) Received: from localhost ([::1]:40574 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1l5Rgq-0003NM-3A for importer@patchew.org; Fri, 29 Jan 2021 06:11:48 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:59896) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1l5RWE-0004nh-GW for qemu-devel@nongnu.org; Fri, 29 Jan 2021 06:00:50 -0500 Received: from mail-wr1-x42f.google.com ([2a00:1450:4864:20::42f]:36764) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1l5RW4-00074K-6R for qemu-devel@nongnu.org; Fri, 29 Jan 2021 06:00:50 -0500 Received: by mail-wr1-x42f.google.com with SMTP id 6so8390658wri.3 for ; Fri, 29 Jan 2021 03:00:39 -0800 (PST) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [81.2.115.148]) by smtp.gmail.com with ESMTPSA id w20sm9268761wmm.12.2021.01.29.03.00.37 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 29 Jan 2021 03:00:38 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:subject:date:message-id:in-reply-to:references:mime-version :content-transfer-encoding; bh=VDHZCdr7wAWmLu1nBxqmNWwzakTz8BqCkNP46PFd2yA=; b=Y3IUc3uugkW3GAOJfM/z7PczmfGorUISq6TLlfW5rkC5TGsWWN1ELySRWRprnQRcRG ND6HlTfT7ES0kh4+qDdAJVn/QWTeEp+q/DaxZVVMaGj9GALH9Yo9GQfIxeSZ3zqD99uk W3Ms4fITMMzWHjZ0Q5Jkmeh8ZAPqAGNXbqzUj54/E+QQv963qf5z5L7Q5RFL4wr0/SeP srvhSMMmcZSwHTZLqPRb7xO1Ig/pgk9CVPqqz/6VY6y01khZLj26GlQR3EmCMiLL1NJN FU5cBjUviVnyQvNGIdzkKHmC+PFmzkrdlPyzijUwuBnEd/9uJ8BZOCRk0VDMfHsmSHVV dkqA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=VDHZCdr7wAWmLu1nBxqmNWwzakTz8BqCkNP46PFd2yA=; b=p0VT07HQ1zNqb6lzRn7sQeo9hymyZMDUwYl1WJCJXydLGyaj5dpIYEdo/o1/ryuulc v06tDfRRMyQV4qa2K2gNTd+irGmTq6h1JALpnIGZPUq9B/Ai/e2gX+p2vTOCoKfrmR/g bPlJttGMdU12UJ6eYhr7HsfMtmGXv4fKhKckTrTVZzBjbHkOQ5Nad0cNq4H+J9xCKaBB hm8QJ2SIqhcl/IfuKkhn9w7p6VFFpueO3e7nKo8XIlNjI8eQuR+9o3Qq/1d7ZwarPtxH 5UC1SsY9RM5GxILFu7kmKbpCz3kvaeh0JrIby8s3GJg+K0xQe3XtjsgbdFRzb78rohIB lXGQ== X-Gm-Message-State: AOAM5302jRJsLgre77Gy0DEmiH1bA2ZnTo+Zn2UT6WFKzXpXKPTWNqp6 cE9DnNO5p73uKvTzun89gmgIs6pxVRzYdw== X-Google-Smtp-Source: ABdhPJx4gygDfiFV4wvlJMbDccE/EGBRWZvarhbVorWU3t2N83VUgpdmlgCtE2+NrrXLec5CLyrJ4A== X-Received: by 2002:adf:f307:: with SMTP id i7mr3778390wro.367.1611918038747; Fri, 29 Jan 2021 03:00:38 -0800 (PST) From: Peter Maydell To: qemu-devel@nongnu.org Subject: [PULL 26/46] tests: Add a simple test of the CMSDK APB dual timer Date: Fri, 29 Jan 2021 10:59:52 +0000 Message-Id: <20210129110012.8660-27-peter.maydell@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20210129110012.8660-1-peter.maydell@linaro.org> References: <20210129110012.8660-1-peter.maydell@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2a00:1450:4864:20::42f; envelope-from=peter.maydell@linaro.org; helo=mail-wr1-x42f.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.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @linaro.org) Add a simple test of the CMSDK dual timer, since we're about to do some refactoring of how it is clocked. Signed-off-by: Peter Maydell Tested-by: Philippe Mathieu-Daud=C3=A9 Reviewed-by: Philippe Mathieu-Daud=C3=A9 Reviewed-by: Luc Michel Message-id: 20210128114145.20536-6-peter.maydell@linaro.org Message-id: 20210121190622.22000-6-peter.maydell@linaro.org --- tests/qtest/cmsdk-apb-dualtimer-test.c | 130 +++++++++++++++++++++++++ MAINTAINERS | 1 + tests/qtest/meson.build | 1 + 3 files changed, 132 insertions(+) create mode 100644 tests/qtest/cmsdk-apb-dualtimer-test.c diff --git a/tests/qtest/cmsdk-apb-dualtimer-test.c b/tests/qtest/cmsdk-apb= -dualtimer-test.c new file mode 100644 index 00000000000..ad6a758289c --- /dev/null +++ b/tests/qtest/cmsdk-apb-dualtimer-test.c @@ -0,0 +1,130 @@ +/* + * QTest testcase for the CMSDK APB dualtimer device + * + * Copyright (c) 2021 Linaro Limited + * + * This program is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License as published by the + * Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, but WIT= HOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * for more details. + */ + +#include "qemu/osdep.h" +#include "libqtest-single.h" + +/* IoTKit/ARMSSE dualtimer; driven at 25MHz in mps2-an385, so 40ns per tic= k */ +#define TIMER_BASE 0x40002000 + +#define TIMER1LOAD 0 +#define TIMER1VALUE 4 +#define TIMER1CONTROL 8 +#define TIMER1INTCLR 0xc +#define TIMER1RIS 0x10 +#define TIMER1MIS 0x14 +#define TIMER1BGLOAD 0x18 + +#define TIMER2LOAD 0x20 +#define TIMER2VALUE 0x24 +#define TIMER2CONTROL 0x28 +#define TIMER2INTCLR 0x2c +#define TIMER2RIS 0x30 +#define TIMER2MIS 0x34 +#define TIMER2BGLOAD 0x38 + +#define CTRL_ENABLE (1 << 7) +#define CTRL_PERIODIC (1 << 6) +#define CTRL_INTEN (1 << 5) +#define CTRL_PRESCALE_1 (0 << 2) +#define CTRL_PRESCALE_16 (1 << 2) +#define CTRL_PRESCALE_256 (2 << 2) +#define CTRL_32BIT (1 << 1) +#define CTRL_ONESHOT (1 << 0) + +static void test_dualtimer(void) +{ + g_assert_true(readl(TIMER_BASE + TIMER1RIS) =3D=3D 0); + + /* Start timer: will fire after 40000 ns */ + writel(TIMER_BASE + TIMER1LOAD, 1000); + /* enable in free-running, wrapping, interrupt mode */ + writel(TIMER_BASE + TIMER1CONTROL, CTRL_ENABLE | CTRL_INTEN); + + /* Step to just past the 500th tick and check VALUE */ + clock_step(500 * 40 + 1); + g_assert_cmpuint(readl(TIMER_BASE + TIMER1RIS), =3D=3D, 0); + g_assert_cmpuint(readl(TIMER_BASE + TIMER1VALUE), =3D=3D, 500); + + /* Just past the 1000th tick: timer should have fired */ + clock_step(500 * 40); + g_assert_cmpuint(readl(TIMER_BASE + TIMER1RIS), =3D=3D, 1); + g_assert_cmpuint(readl(TIMER_BASE + TIMER1VALUE), =3D=3D, 0); + + /* + * We are in free-running wrapping 16-bit mode, so on the following + * tick VALUE should have wrapped round to 0xffff. + */ + clock_step(40); + g_assert_cmpuint(readl(TIMER_BASE + TIMER1VALUE), =3D=3D, 0xffff); + + /* Check that any write to INTCLR clears interrupt */ + writel(TIMER_BASE + TIMER1INTCLR, 1); + g_assert_cmpuint(readl(TIMER_BASE + TIMER1RIS), =3D=3D, 0); + + /* Turn off the timer */ + writel(TIMER_BASE + TIMER1CONTROL, 0); +} + +static void test_prescale(void) +{ + g_assert_true(readl(TIMER_BASE + TIMER2RIS) =3D=3D 0); + + /* Start timer: will fire after 40 * 256 * 1000 =3D=3D 1024000 ns */ + writel(TIMER_BASE + TIMER2LOAD, 1000); + /* enable in periodic, wrapping, interrupt mode, prescale 256 */ + writel(TIMER_BASE + TIMER2CONTROL, + CTRL_ENABLE | CTRL_INTEN | CTRL_PERIODIC | CTRL_PRESCALE_256); + + /* Step to just past the 500th tick and check VALUE */ + clock_step(40 * 256 * 501); + g_assert_cmpuint(readl(TIMER_BASE + TIMER2RIS), =3D=3D, 0); + g_assert_cmpuint(readl(TIMER_BASE + TIMER2VALUE), =3D=3D, 500); + + /* Just past the 1000th tick: timer should have fired */ + clock_step(40 * 256 * 500); + g_assert_cmpuint(readl(TIMER_BASE + TIMER2RIS), =3D=3D, 1); + g_assert_cmpuint(readl(TIMER_BASE + TIMER2VALUE), =3D=3D, 0); + + /* In periodic mode the tick VALUE now reloads */ + clock_step(40 * 256); + g_assert_cmpuint(readl(TIMER_BASE + TIMER2VALUE), =3D=3D, 1000); + + /* Check that any write to INTCLR clears interrupt */ + writel(TIMER_BASE + TIMER2INTCLR, 1); + g_assert_cmpuint(readl(TIMER_BASE + TIMER2RIS), =3D=3D, 0); + + /* Turn off the timer */ + writel(TIMER_BASE + TIMER2CONTROL, 0); +} + +int main(int argc, char **argv) +{ + int r; + + g_test_init(&argc, &argv, NULL); + + qtest_start("-machine mps2-an385"); + + qtest_add_func("/cmsdk-apb-dualtimer/dualtimer", test_dualtimer); + qtest_add_func("/cmsdk-apb-dualtimer/prescale", test_prescale); + + r =3D g_test_run(); + + qtest_end(); + + return r; +} diff --git a/MAINTAINERS b/MAINTAINERS index 3729b89f359..154a91d12e5 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -584,6 +584,7 @@ F: include/hw/timer/cmsdk-apb-timer.h F: tests/qtest/cmsdk-apb-timer-test.c F: hw/timer/cmsdk-apb-dualtimer.c F: include/hw/timer/cmsdk-apb-dualtimer.h +F: tests/qtest/cmsdk-apb-dualtimer-test.c F: hw/char/cmsdk-apb-uart.c F: include/hw/char/cmsdk-apb-uart.h F: hw/watchdog/cmsdk-apb-watchdog.c diff --git a/tests/qtest/meson.build b/tests/qtest/meson.build index 5b10bfbcfb0..c83bc211b6a 100644 --- a/tests/qtest/meson.build +++ b/tests/qtest/meson.build @@ -142,6 +142,7 @@ qtests_npcm7xx =3D \ 'npcm7xx_timer-test', 'npcm7xx_watchdog_timer-test'] qtests_arm =3D \ + (config_all_devices.has_key('CONFIG_CMSDK_APB_DUALTIMER') ? ['cmsdk-apb-= dualtimer-test'] : []) + \ (config_all_devices.has_key('CONFIG_CMSDK_APB_TIMER') ? ['cmsdk-apb-time= r-test'] : []) + \ (config_all_devices.has_key('CONFIG_CMSDK_APB_WATCHDOG') ? ['cmsdk-apb-w= atchdog-test'] : []) + \ (config_all_devices.has_key('CONFIG_PFLASH_CFI02') ? ['pflash-cfi02-test= '] : []) + \ --=20 2.20.1 From nobody Thu May 16 19:07:36 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1611919128; cv=none; d=zohomail.com; s=zohoarc; b=L3+KBjV41I3Ghe1yfI15YGo0hwvaLxoygwc/ibVJGCyGcyuwatvTMg9E8uxDSREbing4fanIGpdeqM1v3gwGIR5LIac8cJykUUArJyKTGfMLP3La25xA3TFIn9h1Qggu+/lZp/U9XDrPfJ3h8jOt/ByItJnVL+4luLQYabOXVbc= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1611919128; h=Content-Type:Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=M46FLnPnSJOp6CKTMzh+U8svgpRWa1S8nofyLSZE57c=; b=WyAih75JCTVr/c78Uboo+ofG1XmKKtFXPQb16/5cSwtOF+XRiYZowYcbbt1qXx8orHQZ7TsXTKTlTT32j+azf4OIaKKkvdzoz2Fo///4/y38sDdkcwcSIP2sVxJ0eCvFJEsR59zf4Oi+79akluUsQkTIJ9qqrBNGm4h83HQaK6w= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1611919128548631.389875720688; Fri, 29 Jan 2021 03:18:48 -0800 (PST) Received: from localhost ([::1]:35112 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1l5Rnb-00047y-H8 for importer@patchew.org; Fri, 29 Jan 2021 06:18:47 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:59922) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1l5RWF-0004q1-Cs for qemu-devel@nongnu.org; Fri, 29 Jan 2021 06:00:51 -0500 Received: from mail-wr1-x42b.google.com ([2a00:1450:4864:20::42b]:43313) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1l5RW4-00074U-RO for qemu-devel@nongnu.org; Fri, 29 Jan 2021 06:00:51 -0500 Received: by mail-wr1-x42b.google.com with SMTP id z6so8339971wrq.10 for ; Fri, 29 Jan 2021 03:00:40 -0800 (PST) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [81.2.115.148]) by smtp.gmail.com with ESMTPSA id w20sm9268761wmm.12.2021.01.29.03.00.38 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 29 Jan 2021 03:00:39 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:subject:date:message-id:in-reply-to:references:mime-version :content-transfer-encoding; bh=M46FLnPnSJOp6CKTMzh+U8svgpRWa1S8nofyLSZE57c=; b=FXBtirY4Ffs3ABiDmYDIfcEv5j6hPAeTEhyCTedRl4sBuVf0J5q5TJWtkcfcUp9JMd Qo508IWHvb/qfciIRqXpECia8SopyEmRlDKhpiMNdpJeQuecyoNkTrk5TV4e5DTZVZ2k JM2eG0c3jYN2a5u/LwccKNkHlKhKOSiqADm6ROCns0jVHwsaLpizuXXStUhmrG73rtls KS2gYS3QGbXxrnVgtVrYPYiXHkLEdsYa+65nMgEVqPgpqiMhzLlPcUNfk4IdON5RrCu1 Ygya1xngVoc5h8QWGRJply6/yUkgjN2TauPYd9ValRnWPL/WHwJcujL3gsbEWSdCzu2a GUYA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=M46FLnPnSJOp6CKTMzh+U8svgpRWa1S8nofyLSZE57c=; b=e7iyHIqLEuH0yJZ9XfRipWBTH4o1vIXWU1JAg615205nl1x2X4URZee9rFctGvXh8e ZdO96Y+9LrMqlUVptHKrLyPL2A7xnBYxS6dc0H8EDssKmjUmSG4rdqp8JKR3sr0gFmgm c+YGMVuIhVmupISMGC96kKbOrxzfhwLnR5s4ikqE8pgmYhYreOtCkWrBEV8atvAiPtoh 0fSYMxhtqigXok5v3LSg/T0h72ih3OfMv22GaE3WVTNhWa9MdA6chZ60xS1CwNLLEdu5 HrH5RBGiQCFE9kqL4idiQN/zyXy9RNriq70afwPCuyBvgSp6/AS8rZ4McNQWNQlU7x1V LvnA== X-Gm-Message-State: AOAM530WAeuZ+6mfdJF2zhrtAeXBQchhHwHniWq3p1NCaCecHRSmWEwa lPTOZQkNORdGqzJpgptqRscGtYJTCf8nKw== X-Google-Smtp-Source: ABdhPJwQNEwBQ/xzkPkUMwy90fQcSSO9JdbFpEOgP2p0VQBsR5Nt6KxH+9tWGuAYz0k+FBalCIZc9Q== X-Received: by 2002:adf:b78d:: with SMTP id s13mr3948237wre.344.1611918039572; Fri, 29 Jan 2021 03:00:39 -0800 (PST) From: Peter Maydell To: qemu-devel@nongnu.org Subject: [PULL 27/46] hw/timer/cmsdk-apb-timer: Rename CMSDKAPBTIMER struct to CMSDKAPBTimer Date: Fri, 29 Jan 2021 10:59:53 +0000 Message-Id: <20210129110012.8660-28-peter.maydell@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20210129110012.8660-1-peter.maydell@linaro.org> References: <20210129110012.8660-1-peter.maydell@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2a00:1450:4864:20::42b; envelope-from=peter.maydell@linaro.org; helo=mail-wr1-x42b.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.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @linaro.org) The state struct for the CMSDK APB timer device doesn't follow our usual naming convention of camelcase -- "CMSDK" and "APB" are both acronyms, but "TIMER" is not so should not be all-uppercase. Globally rename the struct to "CMSDKAPBTimer" (bringing it into line with CMSDKAPBWatchdog and CMSDKAPBDualTimer; CMSDKAPBUART remains as-is because "UART" is an acronym). Commit created with: perl -p -i -e 's/CMSDKAPBTIMER/CMSDKAPBTimer/g' hw/timer/cmsdk-apb-timer.c= include/hw/arm/armsse.h include/hw/timer/cmsdk-apb-timer.h Signed-off-by: Peter Maydell Reviewed-by: Philippe Mathieu-Daud=C3=A9 Reviewed-by: Luc Michel Tested-by: Philippe Mathieu-Daud=C3=A9 Message-id: 20210128114145.20536-7-peter.maydell@linaro.org Message-id: 20210121190622.22000-7-peter.maydell@linaro.org --- include/hw/arm/armsse.h | 6 +++--- include/hw/timer/cmsdk-apb-timer.h | 4 ++-- hw/timer/cmsdk-apb-timer.c | 28 ++++++++++++++-------------- 3 files changed, 19 insertions(+), 19 deletions(-) diff --git a/include/hw/arm/armsse.h b/include/hw/arm/armsse.h index 77f86771c30..83f5e28c16e 100644 --- a/include/hw/arm/armsse.h +++ b/include/hw/arm/armsse.h @@ -153,9 +153,9 @@ struct ARMSSE { TZPPC apb_ppc0; TZPPC apb_ppc1; TZMPC mpc[IOTS_NUM_MPC]; - CMSDKAPBTIMER timer0; - CMSDKAPBTIMER timer1; - CMSDKAPBTIMER s32ktimer; + CMSDKAPBTimer timer0; + CMSDKAPBTimer timer1; + CMSDKAPBTimer s32ktimer; qemu_or_irq ppc_irq_orgate; SplitIRQ sec_resp_splitter; SplitIRQ ppc_irq_splitter[NUM_PPCS]; diff --git a/include/hw/timer/cmsdk-apb-timer.h b/include/hw/timer/cmsdk-ap= b-timer.h index 0d80b2a48cd..baa009bb2da 100644 --- a/include/hw/timer/cmsdk-apb-timer.h +++ b/include/hw/timer/cmsdk-apb-timer.h @@ -18,9 +18,9 @@ #include "qom/object.h" =20 #define TYPE_CMSDK_APB_TIMER "cmsdk-apb-timer" -OBJECT_DECLARE_SIMPLE_TYPE(CMSDKAPBTIMER, CMSDK_APB_TIMER) +OBJECT_DECLARE_SIMPLE_TYPE(CMSDKAPBTimer, CMSDK_APB_TIMER) =20 -struct CMSDKAPBTIMER { +struct CMSDKAPBTimer { /*< private >*/ SysBusDevice parent_obj; =20 diff --git a/hw/timer/cmsdk-apb-timer.c b/hw/timer/cmsdk-apb-timer.c index f85f1309f37..ae9c5422540 100644 --- a/hw/timer/cmsdk-apb-timer.c +++ b/hw/timer/cmsdk-apb-timer.c @@ -67,14 +67,14 @@ static const int timer_id[] =3D { 0x0d, 0xf0, 0x05, 0xb1, /* CID0..CID3 */ }; =20 -static void cmsdk_apb_timer_update(CMSDKAPBTIMER *s) +static void cmsdk_apb_timer_update(CMSDKAPBTimer *s) { qemu_set_irq(s->timerint, !!(s->intstatus & R_INTSTATUS_IRQ_MASK)); } =20 static uint64_t cmsdk_apb_timer_read(void *opaque, hwaddr offset, unsigned= size) { - CMSDKAPBTIMER *s =3D CMSDK_APB_TIMER(opaque); + CMSDKAPBTimer *s =3D CMSDK_APB_TIMER(opaque); uint64_t r; =20 switch (offset) { @@ -106,7 +106,7 @@ static uint64_t cmsdk_apb_timer_read(void *opaque, hwad= dr offset, unsigned size) static void cmsdk_apb_timer_write(void *opaque, hwaddr offset, uint64_t va= lue, unsigned size) { - CMSDKAPBTIMER *s =3D CMSDK_APB_TIMER(opaque); + CMSDKAPBTimer *s =3D CMSDK_APB_TIMER(opaque); =20 trace_cmsdk_apb_timer_write(offset, value, size); =20 @@ -181,7 +181,7 @@ static const MemoryRegionOps cmsdk_apb_timer_ops =3D { =20 static void cmsdk_apb_timer_tick(void *opaque) { - CMSDKAPBTIMER *s =3D CMSDK_APB_TIMER(opaque); + CMSDKAPBTimer *s =3D CMSDK_APB_TIMER(opaque); =20 if (s->ctrl & R_CTRL_IRQEN_MASK) { s->intstatus |=3D R_INTSTATUS_IRQ_MASK; @@ -191,7 +191,7 @@ static void cmsdk_apb_timer_tick(void *opaque) =20 static void cmsdk_apb_timer_reset(DeviceState *dev) { - CMSDKAPBTIMER *s =3D CMSDK_APB_TIMER(dev); + CMSDKAPBTimer *s =3D CMSDK_APB_TIMER(dev); =20 trace_cmsdk_apb_timer_reset(); s->ctrl =3D 0; @@ -206,7 +206,7 @@ static void cmsdk_apb_timer_reset(DeviceState *dev) static void cmsdk_apb_timer_init(Object *obj) { SysBusDevice *sbd =3D SYS_BUS_DEVICE(obj); - CMSDKAPBTIMER *s =3D CMSDK_APB_TIMER(obj); + CMSDKAPBTimer *s =3D CMSDK_APB_TIMER(obj); =20 memory_region_init_io(&s->iomem, obj, &cmsdk_apb_timer_ops, s, "cmsdk-apb-timer", 0x1000); @@ -216,7 +216,7 @@ static void cmsdk_apb_timer_init(Object *obj) =20 static void cmsdk_apb_timer_realize(DeviceState *dev, Error **errp) { - CMSDKAPBTIMER *s =3D CMSDK_APB_TIMER(dev); + CMSDKAPBTimer *s =3D CMSDK_APB_TIMER(dev); =20 if (s->pclk_frq =3D=3D 0) { error_setg(errp, "CMSDK APB timer: pclk-frq property must be set"); @@ -239,17 +239,17 @@ static const VMStateDescription cmsdk_apb_timer_vmsta= te =3D { .version_id =3D 1, .minimum_version_id =3D 1, .fields =3D (VMStateField[]) { - VMSTATE_PTIMER(timer, CMSDKAPBTIMER), - VMSTATE_UINT32(ctrl, CMSDKAPBTIMER), - VMSTATE_UINT32(value, CMSDKAPBTIMER), - VMSTATE_UINT32(reload, CMSDKAPBTIMER), - VMSTATE_UINT32(intstatus, CMSDKAPBTIMER), + VMSTATE_PTIMER(timer, CMSDKAPBTimer), + VMSTATE_UINT32(ctrl, CMSDKAPBTimer), + VMSTATE_UINT32(value, CMSDKAPBTimer), + VMSTATE_UINT32(reload, CMSDKAPBTimer), + VMSTATE_UINT32(intstatus, CMSDKAPBTimer), VMSTATE_END_OF_LIST() } }; =20 static Property cmsdk_apb_timer_properties[] =3D { - DEFINE_PROP_UINT32("pclk-frq", CMSDKAPBTIMER, pclk_frq, 0), + DEFINE_PROP_UINT32("pclk-frq", CMSDKAPBTimer, pclk_frq, 0), DEFINE_PROP_END_OF_LIST(), }; =20 @@ -266,7 +266,7 @@ static void cmsdk_apb_timer_class_init(ObjectClass *kla= ss, void *data) static const TypeInfo cmsdk_apb_timer_info =3D { .name =3D TYPE_CMSDK_APB_TIMER, .parent =3D TYPE_SYS_BUS_DEVICE, - .instance_size =3D sizeof(CMSDKAPBTIMER), + .instance_size =3D sizeof(CMSDKAPBTimer), .instance_init =3D cmsdk_apb_timer_init, .class_init =3D cmsdk_apb_timer_class_init, }; --=20 2.20.1 From nobody Thu May 16 19:07:36 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1611919505; cv=none; d=zohomail.com; s=zohoarc; b=YDsd8owWuJ/ek2+YU1jNOXWjqFDX79vMSahDNjQYs2DVYMD95M3gBGq0bZm1E2Cl0avh7akv8f4vhqdn2H6pCgpfVqUULfeUiGHzivn5N3NwaNBHxEQym0fKbcD0OTsHYO0JglxpPeeGXTceVYO47TU4WLPSw4+9dZFHMAhJ7Co= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1611919505; h=Content-Type:Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=kUOp22EsTKgUuurZMNtwMQiMUdVfM/wWPoj1JapbOFU=; b=DED6Cxd601dPVXhu4Iv+OH1a4E5t0SQjimKP5eoqF0lE9wVLaOo8JW/3bv2XITtcZuKYVWqx08dleYPvFlEiFeOgEFkoDffC7cQsTp076UyQ0DOPyVkGeMXCbhZG8Cv1lcy7TjQL8rmliJIebZcH6NjQ3G0E9iX2aDhGL5m1BgU= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 161191950522794.59972447325856; Fri, 29 Jan 2021 03:25:05 -0800 (PST) Received: from localhost ([::1]:54840 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1l5Rtf-0003sV-Pi for importer@patchew.org; Fri, 29 Jan 2021 06:25:03 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:60006) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1l5RWJ-0004zZ-Bg for qemu-devel@nongnu.org; Fri, 29 Jan 2021 06:00:55 -0500 Received: from mail-wr1-x430.google.com ([2a00:1450:4864:20::430]:37922) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1l5RW5-00074n-Tc for qemu-devel@nongnu.org; Fri, 29 Jan 2021 06:00:55 -0500 Received: by mail-wr1-x430.google.com with SMTP id s7so5398309wru.5 for ; Fri, 29 Jan 2021 03:00:41 -0800 (PST) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [81.2.115.148]) by smtp.gmail.com with ESMTPSA id w20sm9268761wmm.12.2021.01.29.03.00.39 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 29 Jan 2021 03:00:39 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:subject:date:message-id:in-reply-to:references:mime-version :content-transfer-encoding; bh=kUOp22EsTKgUuurZMNtwMQiMUdVfM/wWPoj1JapbOFU=; b=NYQn1FCr+JgqJYUVuqhqRx6Lslvl6jwgVblJ6U/ycAixOJkp4Zce3qFZeumt+JNUWQ Pa8bbIWf6m24OFuqJys7VnlSIlgoS+G2dM3/mexIzFo0Y1V2aU96ZGcM5vPYMM/gZspO H4cX6ZY9AG4c5XgLXk6GsmNIiS43jYJZB5bF9jOvWtrwRZo3GM4SExZikpOLZJhWolMb UPYXt1TKU/Zntx92bmuUmGzUETOGxge3U+epPNIw0rfaA61JzwA8sh/jQR+pephhfa1Q +t9M9RQyAhIoFiI401RWpAofz8YyPHOW+wPyoesdVvrR751nadLbEg91mH13ytEhBnLQ I/zQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=kUOp22EsTKgUuurZMNtwMQiMUdVfM/wWPoj1JapbOFU=; b=Zklqx1FRN1mRZDW6lJ3JD8KplTFCLeNMWc8YlXpNfdRvie2CIFDT7eIJTz35Tyyc+9 zfpFIEUelZ7W572gHmMbQu3Xo0zmbFtG/gfSgXIa5gkeIAEw7UxkaDwg350l9ZUP5asn DP+SI34MGoAyGTvsOKEYZTy+DLQhFzQWWDQYUK6NFMgzk0W+Hnvtgq7963poo/KqhIiP KsOoNL1QLXPaaD8jBGvEYYjmDfofX8mc64OxQzvaY4K7UOJym6HPZZfjALdpB6I+42K/ Uz3Cruu8bxiCOGNiS5+GntKSjuZdFV0Az0a2j6VQL/oSPvnI+hO/N+8+RSAwc+YlkytQ JNmw== X-Gm-Message-State: AOAM533xf/cz8hBuDxczMAuy28h5Bu6HR+VnF4ZMSi6S2WZg0GXXEFz6 Wr4ScEg5XoVMfDuZJcIRFKGF4LSXomlZEA== X-Google-Smtp-Source: ABdhPJxIYHX/eUu8GDRElqAA2qzkFN6X1qOkhm9CXaLm3iDKjbywJFb6iHWvxwX814bpfra+czPgLg== X-Received: by 2002:a5d:4211:: with SMTP id n17mr3897967wrq.37.1611918040467; Fri, 29 Jan 2021 03:00:40 -0800 (PST) From: Peter Maydell To: qemu-devel@nongnu.org Subject: [PULL 28/46] hw/timer/cmsdk-apb-timer: Add Clock input Date: Fri, 29 Jan 2021 10:59:54 +0000 Message-Id: <20210129110012.8660-29-peter.maydell@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20210129110012.8660-1-peter.maydell@linaro.org> References: <20210129110012.8660-1-peter.maydell@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2a00:1450:4864:20::430; envelope-from=peter.maydell@linaro.org; helo=mail-wr1-x430.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.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @linaro.org) As the first step in converting the CMSDK_APB_TIMER device to the Clock framework, add a Clock input. For the moment we do nothing with this clock; we will change the behaviour from using the pclk-frq property to using the Clock once all the users of this device have been converted to wire up the Clock. Since the device doesn't already have a doc comment for its "QEMU interface", we add one including the new Clock. This is a migration compatibility break for machines mps2-an505, mps2-an521, musca-a, musca-b1. Signed-off-by: Peter Maydell Reviewed-by: Philippe Mathieu-Daud=C3=A9 Reviewed-by: Luc Michel Tested-by: Philippe Mathieu-Daud=C3=A9 Message-id: 20210128114145.20536-8-peter.maydell@linaro.org Message-id: 20210121190622.22000-8-peter.maydell@linaro.org --- include/hw/timer/cmsdk-apb-timer.h | 9 +++++++++ hw/timer/cmsdk-apb-timer.c | 7 +++++-- 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/include/hw/timer/cmsdk-apb-timer.h b/include/hw/timer/cmsdk-ap= b-timer.h index baa009bb2da..fc2aa97acac 100644 --- a/include/hw/timer/cmsdk-apb-timer.h +++ b/include/hw/timer/cmsdk-apb-timer.h @@ -15,11 +15,19 @@ #include "hw/qdev-properties.h" #include "hw/sysbus.h" #include "hw/ptimer.h" +#include "hw/clock.h" #include "qom/object.h" =20 #define TYPE_CMSDK_APB_TIMER "cmsdk-apb-timer" OBJECT_DECLARE_SIMPLE_TYPE(CMSDKAPBTimer, CMSDK_APB_TIMER) =20 +/* + * QEMU interface: + * + QOM property "pclk-frq": frequency at which the timer is clocked + * + Clock input "pclk": clock for the timer + * + sysbus MMIO region 0: the register bank + * + sysbus IRQ 0: timer interrupt TIMERINT + */ struct CMSDKAPBTimer { /*< private >*/ SysBusDevice parent_obj; @@ -29,6 +37,7 @@ struct CMSDKAPBTimer { qemu_irq timerint; uint32_t pclk_frq; struct ptimer_state *timer; + Clock *pclk; =20 uint32_t ctrl; uint32_t value; diff --git a/hw/timer/cmsdk-apb-timer.c b/hw/timer/cmsdk-apb-timer.c index ae9c5422540..c63145ff553 100644 --- a/hw/timer/cmsdk-apb-timer.c +++ b/hw/timer/cmsdk-apb-timer.c @@ -35,6 +35,7 @@ #include "hw/sysbus.h" #include "hw/irq.h" #include "hw/registerfields.h" +#include "hw/qdev-clock.h" #include "hw/timer/cmsdk-apb-timer.h" #include "migration/vmstate.h" =20 @@ -212,6 +213,7 @@ static void cmsdk_apb_timer_init(Object *obj) s, "cmsdk-apb-timer", 0x1000); sysbus_init_mmio(sbd, &s->iomem); sysbus_init_irq(sbd, &s->timerint); + s->pclk =3D qdev_init_clock_in(DEVICE(s), "pclk", NULL, NULL); } =20 static void cmsdk_apb_timer_realize(DeviceState *dev, Error **errp) @@ -236,10 +238,11 @@ static void cmsdk_apb_timer_realize(DeviceState *dev,= Error **errp) =20 static const VMStateDescription cmsdk_apb_timer_vmstate =3D { .name =3D "cmsdk-apb-timer", - .version_id =3D 1, - .minimum_version_id =3D 1, + .version_id =3D 2, + .minimum_version_id =3D 2, .fields =3D (VMStateField[]) { VMSTATE_PTIMER(timer, CMSDKAPBTimer), + VMSTATE_CLOCK(pclk, CMSDKAPBTimer), VMSTATE_UINT32(ctrl, CMSDKAPBTimer), VMSTATE_UINT32(value, CMSDKAPBTimer), VMSTATE_UINT32(reload, CMSDKAPBTimer), --=20 2.20.1 From nobody Thu May 16 19:07:36 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1611919354; cv=none; d=zohomail.com; s=zohoarc; b=oJV5ru+FxVDn1mr0FaL1gMqSfbeUHqOCq8bZFLz4S+lLC3fEezHbQaqRRyz1xs35KXCDcBXb2siKcMpiiD38wSHyoNZOLgU5UDCxQTxDqZ5hZjC0xYp4YBlu6SgDB5dFwQ/fpxdTSULKWmlCNhytdUtzcLtpFzhU8nb0kWzGX8Q= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1611919354; h=Content-Type:Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=jcbJyC0r8hp/H80y/scajTOtlzDT5KI7DBhK3LWW4jU=; b=HMEX14wBYb+Lr+NXt46xUNINRRxNu7HAsI3a9Bag/hxFdj3OTxiaMKhdfOO8i9Dkl9Uiq/G6JOiOwfJJGoHYpXgxJrHvnsGg2TPkY9u1yKycnXrUaKJZB8KbzrfJnRQVwEzsEqFHkP158vDdc/zFll3DehHtn2oi9BB022O2l24= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1611919354511868.5095417618198; Fri, 29 Jan 2021 03:22:34 -0800 (PST) Received: from localhost ([::1]:43420 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1l5RrF-0007kp-FH for importer@patchew.org; Fri, 29 Jan 2021 06:22:33 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:59936) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1l5RWG-0004s2-Ao for qemu-devel@nongnu.org; Fri, 29 Jan 2021 06:00:52 -0500 Received: from mail-wr1-x434.google.com ([2a00:1450:4864:20::434]:38997) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1l5RW6-00074w-UK for qemu-devel@nongnu.org; Fri, 29 Jan 2021 06:00:51 -0500 Received: by mail-wr1-x434.google.com with SMTP id a1so8416369wrq.6 for ; Fri, 29 Jan 2021 03:00:42 -0800 (PST) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [81.2.115.148]) by smtp.gmail.com with ESMTPSA id w20sm9268761wmm.12.2021.01.29.03.00.40 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 29 Jan 2021 03:00:40 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:subject:date:message-id:in-reply-to:references:mime-version :content-transfer-encoding; bh=jcbJyC0r8hp/H80y/scajTOtlzDT5KI7DBhK3LWW4jU=; b=OVXDvOs8haaudEjUUIaWslruHxMeR36mV8jrk2b+kaBfnFFHWu5me6lOyJXHwRmpUO nHabmqDFuKORAQOdrSCjP5coWJnKhrBKfHoO4vnRldnINi5YVgWEOqr18TNuHOcXSsKY r+IaS5a8W8dgEtAyj22uRLkX+UgzLqwPLfPPaT5h+haM4sMM+lGJhgcw89vsAgLjs6qO o+dgbbKVjmxbFeaAHqJz+WV64jA0HgCMHPZ0qgsHwPHlDYXq9RPa9vsr8OL307tzFPvl 2C2DQyWPDxhCIqKCdAfRXTzQFK0AermnV28tTPzkxOJaHZxb9KDGTgXKZ3apTmVGBM8k HH3g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=jcbJyC0r8hp/H80y/scajTOtlzDT5KI7DBhK3LWW4jU=; b=Ufmjb+QqJJcVyEODMfzubVV/HB/6wSgcaqhY3uAhjNsqi7RHwoVwlNxpdOGk+amW+S GT78wOMGL7jLIrUPs18doLKweOU0US6tH8Ji32rj/isFruncWw8Bx9sV50QhEJ94RWys oFxFPtnPKGOofA5dbdpgFnxkuATZscvvuhheK8SLUJJjQ+2bWF6A1aXC0D7ALzbuLhqC ouTv3xrawszi4DgOAbHMCTRw8twtYnUIXZcWnggMLu4D+rTocm7YOOlicaP3fy2I3Gjx 9Wmz2F6CVoeNQABjWebDHNIen6/gmPfogX/ucidawiY85ZvnuFGoeP3J8gjXWRWy8Ys1 vt3A== X-Gm-Message-State: AOAM531ULquIcsgQX59OXAxz5W9VPGAKL+/rlgviW096XM8I9WjQyGQ8 95RS3hE+42EVOx0WYD8ryBZaXc5GE+PWhg== X-Google-Smtp-Source: ABdhPJwb1aXusUw5e8AR5bWjBrzLFDM3G0tQ9AMvyxkuCzv2+Wqr0B6GEGMWO0QoakPTGo2FwUeNww== X-Received: by 2002:adf:eb4e:: with SMTP id u14mr3884076wrn.99.1611918041334; Fri, 29 Jan 2021 03:00:41 -0800 (PST) From: Peter Maydell To: qemu-devel@nongnu.org Subject: [PULL 29/46] hw/timer/cmsdk-apb-dualtimer: Add Clock input Date: Fri, 29 Jan 2021 10:59:55 +0000 Message-Id: <20210129110012.8660-30-peter.maydell@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20210129110012.8660-1-peter.maydell@linaro.org> References: <20210129110012.8660-1-peter.maydell@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2a00:1450:4864:20::434; envelope-from=peter.maydell@linaro.org; helo=mail-wr1-x434.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.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @linaro.org) As the first step in converting the CMSDK_APB_DUALTIMER device to the Clock framework, add a Clock input. For the moment we do nothing with this clock; we will change the behaviour from using the pclk-frq property to using the Clock once all the users of this device have been converted to wire up the Clock. We take the opportunity to correct the name of the clock input to match the hardware -- the dual timer names the clock which drives the timers TIMCLK. (It does also have a 'pclk' input, which is used only for the register and APB bus logic; on the SSE-200 these clocks are both connected together.) This is a migration compatibility break for machines mps2-an385, mps2-an386, mps2-an500, mps2-an511, mps2-an505, mps2-an521, musca-a, musca-b1. Signed-off-by: Peter Maydell Reviewed-by: Philippe Mathieu-Daud=C3=A9 Reviewed-by: Luc Michel Tested-by: Philippe Mathieu-Daud=C3=A9 Message-id: 20210128114145.20536-9-peter.maydell@linaro.org Message-id: 20210121190622.22000-9-peter.maydell@linaro.org --- include/hw/timer/cmsdk-apb-dualtimer.h | 3 +++ hw/timer/cmsdk-apb-dualtimer.c | 7 +++++-- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/include/hw/timer/cmsdk-apb-dualtimer.h b/include/hw/timer/cmsd= k-apb-dualtimer.h index 08d9e6fa3d5..3adbb01dd34 100644 --- a/include/hw/timer/cmsdk-apb-dualtimer.h +++ b/include/hw/timer/cmsdk-apb-dualtimer.h @@ -17,6 +17,7 @@ * * QEMU interface: * + QOM property "pclk-frq": frequency at which the timer is clocked + * + Clock input "TIMCLK": clock (for both timers) * + sysbus MMIO region 0: the register bank * + sysbus IRQ 0: combined timer interrupt TIMINTC * + sysbus IRO 1: timer block 1 interrupt TIMINT1 @@ -28,6 +29,7 @@ =20 #include "hw/sysbus.h" #include "hw/ptimer.h" +#include "hw/clock.h" #include "qom/object.h" =20 #define TYPE_CMSDK_APB_DUALTIMER "cmsdk-apb-dualtimer" @@ -62,6 +64,7 @@ struct CMSDKAPBDualTimer { MemoryRegion iomem; qemu_irq timerintc; uint32_t pclk_frq; + Clock *timclk; =20 CMSDKAPBDualTimerModule timermod[CMSDK_APB_DUALTIMER_NUM_MODULES]; uint32_t timeritcr; diff --git a/hw/timer/cmsdk-apb-dualtimer.c b/hw/timer/cmsdk-apb-dualtimer.c index f6534241b94..781b496037b 100644 --- a/hw/timer/cmsdk-apb-dualtimer.c +++ b/hw/timer/cmsdk-apb-dualtimer.c @@ -25,6 +25,7 @@ #include "hw/irq.h" #include "hw/qdev-properties.h" #include "hw/registerfields.h" +#include "hw/qdev-clock.h" #include "hw/timer/cmsdk-apb-dualtimer.h" #include "migration/vmstate.h" =20 @@ -445,6 +446,7 @@ static void cmsdk_apb_dualtimer_init(Object *obj) for (i =3D 0; i < ARRAY_SIZE(s->timermod); i++) { sysbus_init_irq(sbd, &s->timermod[i].timerint); } + s->timclk =3D qdev_init_clock_in(DEVICE(s), "TIMCLK", NULL, NULL); } =20 static void cmsdk_apb_dualtimer_realize(DeviceState *dev, Error **errp) @@ -485,9 +487,10 @@ static const VMStateDescription cmsdk_dualtimermod_vms= tate =3D { =20 static const VMStateDescription cmsdk_apb_dualtimer_vmstate =3D { .name =3D "cmsdk-apb-dualtimer", - .version_id =3D 1, - .minimum_version_id =3D 1, + .version_id =3D 2, + .minimum_version_id =3D 2, .fields =3D (VMStateField[]) { + VMSTATE_CLOCK(timclk, CMSDKAPBDualTimer), VMSTATE_STRUCT_ARRAY(timermod, CMSDKAPBDualTimer, CMSDK_APB_DUALTIMER_NUM_MODULES, 1, cmsdk_dualtimermod_vmstate, --=20 2.20.1 From nobody Thu May 16 19:07:36 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1611919460; cv=none; d=zohomail.com; s=zohoarc; b=n7Qxvn3S4S47ZLYNZZe0DuRpklD5s3h49U9nLKNIvLTktICQBgqNrBRq3UAzVxDjjs8+opD1cKhRyfwIAQuPNndBRQ7pxq1kaZlOcnK/bpJs8wA528PJPQFpUwSQn4cuELmfdPVQif6/QJmfUIQlyms/7OMpacUNboMTrrxtdtE= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1611919460; h=Content-Type:Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=1/VLL2mug+Bt4J4qlQhtUAEkhvzQUTluOBjM1WE/fMk=; b=C4Ixc0/DdsQ1tBQjlCPpdyy8CxDQqw/XEdVS2fS0df2EDt0WUikXx0QhMRSZJepAwue8pLv+j/atLK9xDjgHjcoCVf97zesVux4j1LqKVIPXMwn1FFPQPOYZSXmQGzfAk4LodCxHlQGm9Y9avIEg5S1PivmiBbGINrttyYUqigU= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1611919460576397.9655268533302; Fri, 29 Jan 2021 03:24:20 -0800 (PST) Received: from localhost ([::1]:51868 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1l5Rsx-0002gi-Eg for importer@patchew.org; Fri, 29 Jan 2021 06:24:19 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:59960) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1l5RWH-0004uT-62 for qemu-devel@nongnu.org; Fri, 29 Jan 2021 06:00:53 -0500 Received: from mail-wr1-x42f.google.com ([2a00:1450:4864:20::42f]:43317) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1l5RW7-000751-I5 for qemu-devel@nongnu.org; Fri, 29 Jan 2021 06:00:52 -0500 Received: by mail-wr1-x42f.google.com with SMTP id z6so8340148wrq.10 for ; Fri, 29 Jan 2021 03:00:43 -0800 (PST) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [81.2.115.148]) by smtp.gmail.com with ESMTPSA id w20sm9268761wmm.12.2021.01.29.03.00.41 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 29 Jan 2021 03:00:41 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:subject:date:message-id:in-reply-to:references:mime-version :content-transfer-encoding; bh=1/VLL2mug+Bt4J4qlQhtUAEkhvzQUTluOBjM1WE/fMk=; b=qYmO57PWqDaJ0nA9Hr0QowGOge/4csOsx9QaYP1QhuEv38iAdqu9Efa8UYzaXQopgZ c+xCAvd6KVkTaD2MyYD/E9Ydd/YzkvRwRM8xY8RTfNc6hk4zV9Xsdsk6l3mbnscLJIRg itXvlTNzpE1zPdVvkqyf3d9z847lt487WxPZvTt4wHC7Xxxv2my6nJFoqr2B53JP2vAZ +muMJXkzm1W8mGmo8c2SlYM+aJVU0CmD5cmEiOyLB8O+kTYizrNbC3hjeh0ez5itp6zo UMNyhS6xIdPm9dYdjUSuYZXb19oPto8wIgsul/E8QJ1O+5BK43xt/vZd63YZUsjvD8tC AaFw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=1/VLL2mug+Bt4J4qlQhtUAEkhvzQUTluOBjM1WE/fMk=; b=e1IsbGEf8WHm4Y+dyeIr9NCo5WGZC8npN6UolNHoHEfUOBXL/2J/juZwMoVwT3Njb7 1wtAqRkgVeZ8QetDEW8htSmLKIa9oh5eQQhP3PEikfmv1w8UDr72VxezCOTFG99pV6pd /dL+lzatS7sjI/vyIGtR0Tb2kGvy69gjfo9UOIMPMpifkzaKBpmGLZE+wqYGgcR0n1gG WyW9huVqG/g2FO7Jb1gAg/rdUV0KAzs9pC9voLOl2mkehE4Z8X4/5bf4u1qcq87/Ac/R vHVN4+F143AeiSOPj83OUo65zTBX1H6e88m4HxLE2458eOCL1HonozSpf3sPfWH0jybv VuEQ== X-Gm-Message-State: AOAM5309od8Lw9oN+K2iibCAKOqtu5LJxg/2Ue3eN11C5UOZqtytF2WO hiPpRIuSTtKbSy18lWacUTbCKpzMNUzcUg== X-Google-Smtp-Source: ABdhPJxg8k9c07XN6s4OQEr0urUjDhDVI50vx7QmIzbBMY/iTdJLkWuuUfhvQIdxAdXViMUZVyBFZA== X-Received: by 2002:a5d:6189:: with SMTP id j9mr3854286wru.256.1611918042160; Fri, 29 Jan 2021 03:00:42 -0800 (PST) From: Peter Maydell To: qemu-devel@nongnu.org Subject: [PULL 30/46] hw/watchdog/cmsdk-apb-watchdog: Add Clock input Date: Fri, 29 Jan 2021 10:59:56 +0000 Message-Id: <20210129110012.8660-31-peter.maydell@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20210129110012.8660-1-peter.maydell@linaro.org> References: <20210129110012.8660-1-peter.maydell@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2a00:1450:4864:20::42f; envelope-from=peter.maydell@linaro.org; helo=mail-wr1-x42f.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.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @linaro.org) As the first step in converting the CMSDK_APB_TIMER device to the Clock framework, add a Clock input. For the moment we do nothing with this clock; we will change the behaviour from using the wdogclk-frq property to using the Clock once all the users of this device have been converted to wire up the Clock. This is a migration compatibility break for machines mps2-an385, mps2-an386, mps2-an500, mps2-an511, mps2-an505, mps2-an521, musca-a, musca-b1, lm3s811evb, lm3s6965evb. Signed-off-by: Peter Maydell Reviewed-by: Philippe Mathieu-Daud=C3=A9 Reviewed-by: Luc Michel Tested-by: Philippe Mathieu-Daud=C3=A9 Message-id: 20210128114145.20536-10-peter.maydell@linaro.org Message-id: 20210121190622.22000-10-peter.maydell@linaro.org --- include/hw/watchdog/cmsdk-apb-watchdog.h | 3 +++ hw/watchdog/cmsdk-apb-watchdog.c | 7 +++++-- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/include/hw/watchdog/cmsdk-apb-watchdog.h b/include/hw/watchdog= /cmsdk-apb-watchdog.h index 3da0d43e355..34069ca6969 100644 --- a/include/hw/watchdog/cmsdk-apb-watchdog.h +++ b/include/hw/watchdog/cmsdk-apb-watchdog.h @@ -17,6 +17,7 @@ * * QEMU interface: * + QOM property "wdogclk-frq": frequency at which the watchdog is clock= ed + * + Clock input "WDOGCLK": clock for the watchdog's timer * + sysbus MMIO region 0: the register bank * + sysbus IRQ 0: watchdog interrupt * @@ -33,6 +34,7 @@ =20 #include "hw/sysbus.h" #include "hw/ptimer.h" +#include "hw/clock.h" #include "qom/object.h" =20 #define TYPE_CMSDK_APB_WATCHDOG "cmsdk-apb-watchdog" @@ -54,6 +56,7 @@ struct CMSDKAPBWatchdog { uint32_t wdogclk_frq; bool is_luminary; struct ptimer_state *timer; + Clock *wdogclk; =20 uint32_t control; uint32_t intstatus; diff --git a/hw/watchdog/cmsdk-apb-watchdog.c b/hw/watchdog/cmsdk-apb-watch= dog.c index 5bbadadfa68..b03bcb73628 100644 --- a/hw/watchdog/cmsdk-apb-watchdog.c +++ b/hw/watchdog/cmsdk-apb-watchdog.c @@ -30,6 +30,7 @@ #include "hw/irq.h" #include "hw/qdev-properties.h" #include "hw/registerfields.h" +#include "hw/qdev-clock.h" #include "hw/watchdog/cmsdk-apb-watchdog.h" #include "migration/vmstate.h" =20 @@ -318,6 +319,7 @@ static void cmsdk_apb_watchdog_init(Object *obj) s, "cmsdk-apb-watchdog", 0x1000); sysbus_init_mmio(sbd, &s->iomem); sysbus_init_irq(sbd, &s->wdogint); + s->wdogclk =3D qdev_init_clock_in(DEVICE(s), "WDOGCLK", NULL, NULL); =20 s->is_luminary =3D false; s->id =3D cmsdk_apb_watchdog_id; @@ -346,9 +348,10 @@ static void cmsdk_apb_watchdog_realize(DeviceState *de= v, Error **errp) =20 static const VMStateDescription cmsdk_apb_watchdog_vmstate =3D { .name =3D "cmsdk-apb-watchdog", - .version_id =3D 1, - .minimum_version_id =3D 1, + .version_id =3D 2, + .minimum_version_id =3D 2, .fields =3D (VMStateField[]) { + VMSTATE_CLOCK(wdogclk, CMSDKAPBWatchdog), VMSTATE_PTIMER(timer, CMSDKAPBWatchdog), VMSTATE_UINT32(control, CMSDKAPBWatchdog), VMSTATE_UINT32(intstatus, CMSDKAPBWatchdog), --=20 2.20.1 From nobody Thu May 16 19:07:36 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1611918833; cv=none; d=zohomail.com; s=zohoarc; b=Xc7aIphptl3xLc8ARGLf3XS1r5epBAH1ZUk5rQ3JQbfm9N0GjBj+8TRHcLURImbRxKkqvBb1gIT8QY7Jb3BAP9/zeAdCpn3ngtFh58z2LHmbjom3f3Dfh1M5CTN54Zq97TvAq5pYetyvKMlVo8QyirP5NpjmLevgF9mmXgA+Kbw= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1611918833; h=Content-Type:Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=eht0LJqJ9FMWYx5205hZqgRzo6MSLq+VxidcXNoJE5o=; b=m8VuugwfpaiGv5pfU8UFJDV1hYPrv7csQGNq0qZcNwbvaDcAGB1/GYlQOp1GBCO/M7LdHBLza8+bLOTAVlngL+w7uE61PWu6qxdz7njZgxl1YeqVwM6/dll8PTrDQikWSxgNWNRtk92oFAoWRWgKckWQf0wVk80QL3y+c4aFrsA= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1611918833040850.2406272461941; Fri, 29 Jan 2021 03:13:53 -0800 (PST) Received: from localhost ([::1]:49300 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1l5Rip-0006rx-Ro for importer@patchew.org; Fri, 29 Jan 2021 06:13:51 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:60022) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1l5RWK-00051i-9s for qemu-devel@nongnu.org; Fri, 29 Jan 2021 06:00:56 -0500 Received: from mail-wr1-x429.google.com ([2a00:1450:4864:20::429]:47069) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1l5RW8-00075v-H3 for qemu-devel@nongnu.org; Fri, 29 Jan 2021 06:00:55 -0500 Received: by mail-wr1-x429.google.com with SMTP id q7so8360630wre.13 for ; Fri, 29 Jan 2021 03:00:43 -0800 (PST) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [81.2.115.148]) by smtp.gmail.com with ESMTPSA id w20sm9268761wmm.12.2021.01.29.03.00.42 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 29 Jan 2021 03:00:42 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:subject:date:message-id:in-reply-to:references:mime-version :content-transfer-encoding; bh=eht0LJqJ9FMWYx5205hZqgRzo6MSLq+VxidcXNoJE5o=; b=I56KBXl+5LBHGgLirgc7nvcWNa69AQddpfifFFvt9jdK3d/Kprmtknb06ZCEc8xDzF PaPxp3JRJyY+SmrCnlRL6cD4YxH5l0Tt835/zcgrXTxH2p0z3hGpNK7czRzPQ0WKAEFq M/McjlFRBUOiv1LnICFQno01HGkcyE2O/mFhevWLl8yKux3ApVdB2N9Nh510D8QzOH23 PfhqxsAhUZfqsRmylpPbk9qp9bFE2UEL2XHtGDSBfke5/6yIQiNaORMxa8iuSoo7UOjq GmlFjr/OjMnmz2QIIoRkKO67u6CjLOqW1YhgtT8AgYh10ZqD1hnrvyYc3hdSwWdJds+L /uiQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=eht0LJqJ9FMWYx5205hZqgRzo6MSLq+VxidcXNoJE5o=; b=FwXYv+Fdp8ewmLGlV+cNBSoT3FLy/tCEJiGupbpFeZU3BU3Z7Wi0T5RKbhLsE6oWUW ImfPdbQHEdbSawJ7Cw8drDQlnTeUMsq1HPbfiERW+meaASkpVhGe6rtERZ7wdLf/OQ7T L5WPddwv1huppyMWM7xxeHrCHYaLoEOCJFc3BqcX+18XJEDRgRjJSZDlIAjXl7lBYic7 zxcr7CGOpRE2lDrHmDcOQmhJrnZ1RuOJksUd6RssLBWBCLXXflReqYzZ4IWj+b/pWCa0 Y1Yeh1tHJOkhu9c9bxefn96H6LAMiKh73Xk96HPjoiqWgiEg6q92ZmgCMq7d2zFD/ast Sfrg== X-Gm-Message-State: AOAM532heAX/ENAUcdHEW8A1UfxTNbNi1y/ax10nBUBXmUiYFeq/7tbG qxdRzKmzIq3KNwaebe4OWz0Ui3oPD9BGxA== X-Google-Smtp-Source: ABdhPJx+61QlB9Le953GDbLjLGAFYR7ofvdlR5mIuZpVk65/PpBsKc51xImevK4EE46Ln5u+6iw3FA== X-Received: by 2002:adf:9d48:: with SMTP id o8mr3919016wre.408.1611918043059; Fri, 29 Jan 2021 03:00:43 -0800 (PST) From: Peter Maydell To: qemu-devel@nongnu.org Subject: [PULL 31/46] hw/arm/armsse: Rename "MAINCLK" property to "MAINCLK_FRQ" Date: Fri, 29 Jan 2021 10:59:57 +0000 Message-Id: <20210129110012.8660-32-peter.maydell@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20210129110012.8660-1-peter.maydell@linaro.org> References: <20210129110012.8660-1-peter.maydell@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2a00:1450:4864:20::429; envelope-from=peter.maydell@linaro.org; helo=mail-wr1-x429.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.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @linaro.org) While we transition the ARMSSE code from integer properties specifying clock frequencies to Clock objects, we want to have the device provide both at once. We want the final name of the main input Clock to be "MAINCLK", following the hardware name. Unfortunately creating an input Clock with a name X creates an under-the-hood QOM property X; for "MAINCLK" this clashes with the existing UINT32 property of that name. Rename the UINT32 property to MAINCLK_FRQ so it can coexist with the MAINCLK Clock; once the transition is complete MAINCLK_FRQ will be deleted. Commit created with: perl -p -i -e 's/MAINCLK/MAINCLK_FRQ/g' hw/arm/{armsse,mps2-tz,musca}.c in= clude/hw/arm/armsse.h Signed-off-by: Peter Maydell Reviewed-by: Philippe Mathieu-Daud=C3=A9 Reviewed-by: Luc Michel Tested-by: Philippe Mathieu-Daud=C3=A9 Message-id: 20210128114145.20536-11-peter.maydell@linaro.org Message-id: 20210121190622.22000-11-peter.maydell@linaro.org --- include/hw/arm/armsse.h | 2 +- hw/arm/armsse.c | 6 +++--- hw/arm/mps2-tz.c | 2 +- hw/arm/musca.c | 2 +- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/include/hw/arm/armsse.h b/include/hw/arm/armsse.h index 83f5e28c16e..4860a793f4b 100644 --- a/include/hw/arm/armsse.h +++ b/include/hw/arm/armsse.h @@ -39,7 +39,7 @@ * QEMU interface: * + QOM property "memory" is a MemoryRegion containing the devices provi= ded * by the board model. - * + QOM property "MAINCLK" is the frequency of the main system clock + * + QOM property "MAINCLK_FRQ" is the frequency of the main system clock * + QOM property "EXP_NUMIRQ" sets the number of expansion interrupts. * (In hardware, the SSE-200 permits the number of expansion interrupts * for the two CPUs to be configured separately, but we restrict it to diff --git a/hw/arm/armsse.c b/hw/arm/armsse.c index baac027659d..d2ba0459c44 100644 --- a/hw/arm/armsse.c +++ b/hw/arm/armsse.c @@ -47,7 +47,7 @@ static Property iotkit_properties[] =3D { DEFINE_PROP_LINK("memory", ARMSSE, board_memory, TYPE_MEMORY_REGION, MemoryRegion *), DEFINE_PROP_UINT32("EXP_NUMIRQ", ARMSSE, exp_numirq, 64), - DEFINE_PROP_UINT32("MAINCLK", ARMSSE, mainclk_frq, 0), + DEFINE_PROP_UINT32("MAINCLK_FRQ", ARMSSE, mainclk_frq, 0), DEFINE_PROP_UINT32("SRAM_ADDR_WIDTH", ARMSSE, sram_addr_width, 15), DEFINE_PROP_UINT32("init-svtor", ARMSSE, init_svtor, 0x10000000), DEFINE_PROP_BOOL("CPU0_FPU", ARMSSE, cpu_fpu[0], true), @@ -59,7 +59,7 @@ static Property armsse_properties[] =3D { DEFINE_PROP_LINK("memory", ARMSSE, board_memory, TYPE_MEMORY_REGION, MemoryRegion *), DEFINE_PROP_UINT32("EXP_NUMIRQ", ARMSSE, exp_numirq, 64), - DEFINE_PROP_UINT32("MAINCLK", ARMSSE, mainclk_frq, 0), + DEFINE_PROP_UINT32("MAINCLK_FRQ", ARMSSE, mainclk_frq, 0), DEFINE_PROP_UINT32("SRAM_ADDR_WIDTH", ARMSSE, sram_addr_width, 15), DEFINE_PROP_UINT32("init-svtor", ARMSSE, init_svtor, 0x10000000), DEFINE_PROP_BOOL("CPU0_FPU", ARMSSE, cpu_fpu[0], false), @@ -448,7 +448,7 @@ static void armsse_realize(DeviceState *dev, Error **er= rp) } =20 if (!s->mainclk_frq) { - error_setg(errp, "MAINCLK property was not set"); + error_setg(errp, "MAINCLK_FRQ property was not set"); return; } =20 diff --git a/hw/arm/mps2-tz.c b/hw/arm/mps2-tz.c index 3707876d6d4..6a9eed9022a 100644 --- a/hw/arm/mps2-tz.c +++ b/hw/arm/mps2-tz.c @@ -402,7 +402,7 @@ static void mps2tz_common_init(MachineState *machine) object_property_set_link(OBJECT(&mms->iotkit), "memory", OBJECT(system_memory), &error_abort); qdev_prop_set_uint32(iotkitdev, "EXP_NUMIRQ", MPS2TZ_NUMIRQ); - qdev_prop_set_uint32(iotkitdev, "MAINCLK", SYSCLK_FRQ); + qdev_prop_set_uint32(iotkitdev, "MAINCLK_FRQ", SYSCLK_FRQ); sysbus_realize(SYS_BUS_DEVICE(&mms->iotkit), &error_fatal); =20 /* diff --git a/hw/arm/musca.c b/hw/arm/musca.c index b50157f63a6..d82bef11cf2 100644 --- a/hw/arm/musca.c +++ b/hw/arm/musca.c @@ -375,7 +375,7 @@ static void musca_init(MachineState *machine) qdev_prop_set_uint32(ssedev, "EXP_NUMIRQ", mmc->num_irqs); qdev_prop_set_uint32(ssedev, "init-svtor", mmc->init_svtor); qdev_prop_set_uint32(ssedev, "SRAM_ADDR_WIDTH", mmc->sram_addr_width); - qdev_prop_set_uint32(ssedev, "MAINCLK", SYSCLK_FRQ); + qdev_prop_set_uint32(ssedev, "MAINCLK_FRQ", SYSCLK_FRQ); /* * Musca-A takes the default SSE-200 FPU/DSP settings (ie no for * CPU0 and yes for CPU1); Musca-B1 explicitly enables them for CPU0. --=20 2.20.1 From nobody Thu May 16 19:07:36 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1611919352; cv=none; d=zohomail.com; s=zohoarc; b=YzMPcxVsOfI0LKrqTfMknAS49dsFgIC7AAbVBgZq9uYkXzY033tON1+3+XRVkowg6/seoTlb66tdlOHn//ZeKiMI3gAhdS+0CVoAvTmzRggUDXMMuzgaZAMXT/Iv31rnXk1h+gpUVWvk39ZVOQEEJ4kflB3Fu3iB7XHXcSjFPnY= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1611919352; h=Content-Type:Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=jPNInFcZRqUL6RSZboTJeMy6Ihc+QO3ISy9yB391PuA=; b=Remerb2uDnDIkqHEBl7u6/LbwbFn4BhxORq1w/KSxDhu34uwo7pZUlrzvzNUoCMSLbGSL7dPzPEeKhySQm3KI3ubxMFYULwXX2UJadPxmjmFXGxDG8Z7s85ROIbN9L2zfvDgpEl1jDVoRzCS4KmbC6WuhnbUBr4FSQISDTGoH5M= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1611919352113566.0668372141425; Fri, 29 Jan 2021 03:22:32 -0800 (PST) Received: from localhost ([::1]:43216 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1l5RrD-0007fv-3Y for importer@patchew.org; Fri, 29 Jan 2021 06:22:31 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:59986) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1l5RWI-0004wY-8I for qemu-devel@nongnu.org; Fri, 29 Jan 2021 06:00:54 -0500 Received: from mail-wm1-x330.google.com ([2a00:1450:4864:20::330]:52197) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1l5RW9-00076d-F0 for qemu-devel@nongnu.org; Fri, 29 Jan 2021 06:00:53 -0500 Received: by mail-wm1-x330.google.com with SMTP id m2so6511136wmm.1 for ; Fri, 29 Jan 2021 03:00:44 -0800 (PST) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [81.2.115.148]) by smtp.gmail.com with ESMTPSA id w20sm9268761wmm.12.2021.01.29.03.00.43 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 29 Jan 2021 03:00:43 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:subject:date:message-id:in-reply-to:references:mime-version :content-transfer-encoding; bh=jPNInFcZRqUL6RSZboTJeMy6Ihc+QO3ISy9yB391PuA=; b=E6GFJtVXdXwkv6ccoPUo7ZcYAmFL5R22lVa4y3QdHd5p+7rUtu1YH9/fLaLNU2dnKL pvAuUtOHi2/OThdu2qwR4HnERsmVEJlxDC/VH8a+k0R0WAInafQHdP1yohHa2z+4g8ew /xBN+5d3apL1VtsGy126OvS32Sapd/Oj/UuV9i78E5NAqRCcTRc1GZ7kVzqCBXfp1+8B DUiQRJYH4J7W0eaVRDAJ8Ujdix7aj8t+SUvSohKB6m8uLrjPSZycpHfZr09s+AtadW2w ACF/t9hCAUf5xhOPKLKei+lxhqF6CBKKmqGTl6bSGcJAAaa4J4txOmccoVZOm8P9kW2+ lYTQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=jPNInFcZRqUL6RSZboTJeMy6Ihc+QO3ISy9yB391PuA=; b=VRHR4+V092NJtMHVOXFjDAv21ne1fm6OxHXW9WSjtifEhPkO/zMn4t/GwyGwnwt6i6 472d0a+NsV0Vd3DgRVLD6M2efjwXp9xGDc643oZBR39vU8H+Q3pN8cwYojwNVfJKFPXu yBfqHna4mnVh6CwVhGWwB0HZVvGLS/xgscS00jmp4OAqvLaPWfIqscCdDr2sB0xcUEbL gMD2Sg1RWCm4NIGFImQkrVIp+GgNs3S4XXBnaaYY8hRoeP0UtGbVdil2E+CV6WEvqWYx nIjyvxAt0mPIVFApwOKm8QUxJsiCpRj++KnJe0t0QF+GBHaKSJOVU0AWvcnf2T0W0Q3Q XkqQ== X-Gm-Message-State: AOAM531Un74xKN8Hm7ADLcFq7MD3kDDjPdZWVBDz3VLMgE/SvabY+Rha oGg2JF70OSmikki9q32gjTVzZlC8VXF2JA== X-Google-Smtp-Source: ABdhPJx/I3QASKS+jn6hWjWnNrNFQZcA/kZdEY/MPnwPjHLKFAtopsT73EJCPP6T7y8uGvdF14VtvA== X-Received: by 2002:a1c:730f:: with SMTP id d15mr3210423wmb.135.1611918043930; Fri, 29 Jan 2021 03:00:43 -0800 (PST) From: Peter Maydell To: qemu-devel@nongnu.org Subject: [PULL 32/46] hw/arm/armsse: Wire up clocks Date: Fri, 29 Jan 2021 10:59:58 +0000 Message-Id: <20210129110012.8660-33-peter.maydell@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20210129110012.8660-1-peter.maydell@linaro.org> References: <20210129110012.8660-1-peter.maydell@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2a00:1450:4864:20::330; envelope-from=peter.maydell@linaro.org; helo=mail-wm1-x330.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.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @linaro.org) Create two input clocks on the ARMSSE devices, one for the normal MAINCLK, and one for the 32KHz S32KCLK, and wire these up to the appropriate devices. The old property-based clock frequency setting will remain in place until conversion is complete. This is a migration compatibility break for machines mps2-an505, mps2-an521, musca-a, musca-b1. Signed-off-by: Peter Maydell Reviewed-by: Philippe Mathieu-Daud=C3=A9 Reviewed-by: Luc Michel Tested-by: Philippe Mathieu-Daud=C3=A9 Message-id: 20210128114145.20536-12-peter.maydell@linaro.org Message-id: 20210121190622.22000-12-peter.maydell@linaro.org --- include/hw/arm/armsse.h | 6 ++++++ hw/arm/armsse.c | 17 +++++++++++++++-- 2 files changed, 21 insertions(+), 2 deletions(-) diff --git a/include/hw/arm/armsse.h b/include/hw/arm/armsse.h index 4860a793f4b..bfa1e79c4fe 100644 --- a/include/hw/arm/armsse.h +++ b/include/hw/arm/armsse.h @@ -37,6 +37,8 @@ * per-CPU identity and control register blocks * * QEMU interface: + * + Clock input "MAINCLK": clock for CPUs and most peripherals + * + Clock input "S32KCLK": slow 32KHz clock used for a few peripherals * + QOM property "memory" is a MemoryRegion containing the devices provi= ded * by the board model. * + QOM property "MAINCLK_FRQ" is the frequency of the main system clock @@ -103,6 +105,7 @@ #include "hw/misc/armsse-mhu.h" #include "hw/misc/unimp.h" #include "hw/or-irq.h" +#include "hw/clock.h" #include "hw/core/split-irq.h" #include "hw/cpu/cluster.h" #include "qom/object.h" @@ -209,6 +212,9 @@ struct ARMSSE { =20 uint32_t nsccfg; =20 + Clock *mainclk; + Clock *s32kclk; + /* Properties */ MemoryRegion *board_memory; uint32_t exp_numirq; diff --git a/hw/arm/armsse.c b/hw/arm/armsse.c index d2ba0459c44..4349ce9bfdb 100644 --- a/hw/arm/armsse.c +++ b/hw/arm/armsse.c @@ -21,6 +21,7 @@ #include "hw/arm/armsse.h" #include "hw/arm/boot.h" #include "hw/irq.h" +#include "hw/qdev-clock.h" =20 /* Format of the System Information block SYS_CONFIG register */ typedef enum SysConfigFormat { @@ -241,6 +242,9 @@ static void armsse_init(Object *obj) assert(info->sram_banks <=3D MAX_SRAM_BANKS); assert(info->num_cpus <=3D SSE_MAX_CPUS); =20 + s->mainclk =3D qdev_init_clock_in(DEVICE(s), "MAINCLK", NULL, NULL); + s->s32kclk =3D qdev_init_clock_in(DEVICE(s), "S32KCLK", NULL, NULL); + memory_region_init(&s->container, obj, "armsse-container", UINT64_MAX); =20 for (i =3D 0; i < info->num_cpus; i++) { @@ -711,6 +715,7 @@ static void armsse_realize(DeviceState *dev, Error **er= rp) * map its upstream ends to the right place in the container. */ qdev_prop_set_uint32(DEVICE(&s->timer0), "pclk-frq", s->mainclk_frq); + qdev_connect_clock_in(DEVICE(&s->timer0), "pclk", s->mainclk); if (!sysbus_realize(SYS_BUS_DEVICE(&s->timer0), errp)) { return; } @@ -721,6 +726,7 @@ static void armsse_realize(DeviceState *dev, Error **er= rp) &error_abort); =20 qdev_prop_set_uint32(DEVICE(&s->timer1), "pclk-frq", s->mainclk_frq); + qdev_connect_clock_in(DEVICE(&s->timer1), "pclk", s->mainclk); if (!sysbus_realize(SYS_BUS_DEVICE(&s->timer1), errp)) { return; } @@ -731,6 +737,7 @@ static void armsse_realize(DeviceState *dev, Error **er= rp) &error_abort); =20 qdev_prop_set_uint32(DEVICE(&s->dualtimer), "pclk-frq", s->mainclk_frq= ); + qdev_connect_clock_in(DEVICE(&s->dualtimer), "TIMCLK", s->mainclk); if (!sysbus_realize(SYS_BUS_DEVICE(&s->dualtimer), errp)) { return; } @@ -889,6 +896,7 @@ static void armsse_realize(DeviceState *dev, Error **er= rp) * 0x4002f000: S32K timer */ qdev_prop_set_uint32(DEVICE(&s->s32ktimer), "pclk-frq", S32KCLK); + qdev_connect_clock_in(DEVICE(&s->s32ktimer), "pclk", s->s32kclk); if (!sysbus_realize(SYS_BUS_DEVICE(&s->s32ktimer), errp)) { return; } @@ -982,6 +990,7 @@ static void armsse_realize(DeviceState *dev, Error **er= rp) qdev_get_gpio_in_named(DEVICE(&s->armv7m), "NMI"= , 0)); =20 qdev_prop_set_uint32(DEVICE(&s->s32kwatchdog), "wdogclk-frq", S32KCLK); + qdev_connect_clock_in(DEVICE(&s->s32kwatchdog), "WDOGCLK", s->s32kclk); if (!sysbus_realize(SYS_BUS_DEVICE(&s->s32kwatchdog), errp)) { return; } @@ -992,6 +1001,7 @@ static void armsse_realize(DeviceState *dev, Error **e= rrp) /* 0x40080000 .. 0x4008ffff : ARMSSE second Base peripheral region */ =20 qdev_prop_set_uint32(DEVICE(&s->nswatchdog), "wdogclk-frq", s->mainclk= _frq); + qdev_connect_clock_in(DEVICE(&s->nswatchdog), "WDOGCLK", s->mainclk); if (!sysbus_realize(SYS_BUS_DEVICE(&s->nswatchdog), errp)) { return; } @@ -1000,6 +1010,7 @@ static void armsse_realize(DeviceState *dev, Error **= errp) sysbus_mmio_map(SYS_BUS_DEVICE(&s->nswatchdog), 0, 0x40081000); =20 qdev_prop_set_uint32(DEVICE(&s->swatchdog), "wdogclk-frq", s->mainclk_= frq); + qdev_connect_clock_in(DEVICE(&s->swatchdog), "WDOGCLK", s->mainclk); if (!sysbus_realize(SYS_BUS_DEVICE(&s->swatchdog), errp)) { return; } @@ -1127,9 +1138,11 @@ static void armsse_idau_check(IDAUInterface *ii, uin= t32_t address, =20 static const VMStateDescription armsse_vmstate =3D { .name =3D "iotkit", - .version_id =3D 1, - .minimum_version_id =3D 1, + .version_id =3D 2, + .minimum_version_id =3D 2, .fields =3D (VMStateField[]) { + VMSTATE_CLOCK(mainclk, ARMSSE), + VMSTATE_CLOCK(s32kclk, ARMSSE), VMSTATE_UINT32(nsccfg, ARMSSE), VMSTATE_END_OF_LIST() } --=20 2.20.1 From nobody Thu May 16 19:07:36 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1611919219; cv=none; d=zohomail.com; s=zohoarc; b=dBoVYLUo4wGnbV3zstmYg2wupKtA5KvuJf6uH4+dJ2ZRS6RpFE9PkgZsj+1pTtjMr3mZWrwToZbpcc7zd1yrGB6DefI4vJgitkhFoc2qOaZ1z2bzOcpTE1zJMZS3KLKrs8Psa2HNgZ5Dy8/6JE/77DGecynsdlpjIjjBsdZlLfU= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1611919219; h=Content-Type:Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=QQqVwaIr/CxKQqKVNqKGG0eEOO4Bc0bo6utCYxNydn0=; b=TIE9SHFQrQooyQvf2seWZVXLzxFwBbOxNQeMlL+rYjVWsVHc1WgfZRZYYMhztmn1ixvWHuFC7aCZlxn5OEH5JOScQxda3oYoQio+gaPzfH1DfXNI107ccIiTRofhSVxfjawX4xlYjeq6x3zuvZ2FfKdEjKK3nWEUIukozKcqoxU= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1611919219741269.8916983560629; Fri, 29 Jan 2021 03:20:19 -0800 (PST) Received: from localhost ([::1]:38224 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1l5Rp4-0005YH-Bn for importer@patchew.org; Fri, 29 Jan 2021 06:20:18 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:59998) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1l5RWI-0004yU-V4 for qemu-devel@nongnu.org; Fri, 29 Jan 2021 06:00:55 -0500 Received: from mail-wr1-x42b.google.com ([2a00:1450:4864:20::42b]:37918) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1l5RWA-00076k-7t for qemu-devel@nongnu.org; Fri, 29 Jan 2021 06:00:54 -0500 Received: by mail-wr1-x42b.google.com with SMTP id s7so5398593wru.5 for ; Fri, 29 Jan 2021 03:00:45 -0800 (PST) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [81.2.115.148]) by smtp.gmail.com with ESMTPSA id w20sm9268761wmm.12.2021.01.29.03.00.44 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 29 Jan 2021 03:00:44 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:subject:date:message-id:in-reply-to:references:mime-version :content-transfer-encoding; bh=QQqVwaIr/CxKQqKVNqKGG0eEOO4Bc0bo6utCYxNydn0=; b=W2Szp1QYRj4StLAT2BW469KfdUQjvRHde19KuO6i9lTyDGm/ADC4kQ3Od+xFts8ze5 SpaMMm2GzvbzZHyjDbi9x21NgWI9W4cbX8CM88hLbOZOub+Pm1SXeb5TyXphwUGdF0Kj IKbUmhXptN/zPwSR0YiVwwDcGIJqIS5w8eHVr775dXTULLUOZqDAxamXnsJmWtuF0gEe wn0sjgKiozCfAr0fLmHvGHNG4uOKRz5MUueTPI4t47FBqYMLoFTreFeBFR3qpX93cplv rWY2GjKWpGWPZX3eN7LMM0PEiCdWDuoe3g+hC2krDJ/yv7EQPzo8QcUCV+DDO2jSOPOA Ki6Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=QQqVwaIr/CxKQqKVNqKGG0eEOO4Bc0bo6utCYxNydn0=; b=cH49mDISJnLBCwQEJ3QqhjiHtiSIiaUrErLPj7hR6/Dz1ZeuA4S9BHDWawAg6j8u3F WWRVflAWyAndfocCREENwfXxesJGgjABpWSpKw8Vty2EMlYD9GZtjZTxzsQa48LGV17s vkaP2ATUIRIWGkSe0a0KVjp+aT6ksRFjagorR1k9DyvDxhPpFrD2OSpvYFuDsPGBhJ7V l3r4/LjLUJtxGqSWkNl0M7f8GnBLWAI/9b7yWWr4etpSDEZ2b2fXlCUxTejTGoxEbipn TCEsgpHos1G+ulenjCk1U6c/Za5JFmn0g9baze1C7agMPh70a5L5KUzKz4cBV8hH23dp oAew== X-Gm-Message-State: AOAM533rvTUxXGoLSdPgvsADJaXqN8aQPiHFdhLzYvNJ2iC4JnDoI47A 6bAdsO0tF99hqhj7nGsHCxJbaD/KtL739Q== X-Google-Smtp-Source: ABdhPJywniP52a7ZbsmBTy0e+JOxGk0yXTWFu5pF5SIsw1LmWq8ifg4lDqrQwh1Rz6HNWEfJTmbAmA== X-Received: by 2002:adf:b1da:: with SMTP id r26mr4130970wra.198.1611918044739; Fri, 29 Jan 2021 03:00:44 -0800 (PST) From: Peter Maydell To: qemu-devel@nongnu.org Subject: [PULL 33/46] hw/arm/mps2: Inline CMSDK_APB_TIMER creation Date: Fri, 29 Jan 2021 10:59:59 +0000 Message-Id: <20210129110012.8660-34-peter.maydell@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20210129110012.8660-1-peter.maydell@linaro.org> References: <20210129110012.8660-1-peter.maydell@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2a00:1450:4864:20::42b; envelope-from=peter.maydell@linaro.org; helo=mail-wr1-x42b.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.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @linaro.org) The old-style convenience function cmsdk_apb_timer_create() for creating CMSDK_APB_TIMER objects is used in only two places in mps2.c. Most of the rest of the code in that file uses the new "initialize in place" coding style. We want to connect up a Clock object which should be done between the object creation and realization; rather than adding a Clock* argument to the convenience function, convert the timer creation code in mps2.c to the same style as is used already for the watchdog, dualtimer and other devices, and delete the now-unused convenience function. Signed-off-by: Peter Maydell Reviewed-by: Philippe Mathieu-Daud=C3=A9 Reviewed-by: Luc Michel Tested-by: Philippe Mathieu-Daud=C3=A9 Message-id: 20210128114145.20536-13-peter.maydell@linaro.org Message-id: 20210121190622.22000-13-peter.maydell@linaro.org --- include/hw/timer/cmsdk-apb-timer.h | 21 --------------------- hw/arm/mps2.c | 18 ++++++++++++++++-- 2 files changed, 16 insertions(+), 23 deletions(-) diff --git a/include/hw/timer/cmsdk-apb-timer.h b/include/hw/timer/cmsdk-ap= b-timer.h index fc2aa97acac..54f7ec8c502 100644 --- a/include/hw/timer/cmsdk-apb-timer.h +++ b/include/hw/timer/cmsdk-apb-timer.h @@ -45,25 +45,4 @@ struct CMSDKAPBTimer { uint32_t intstatus; }; =20 -/** - * cmsdk_apb_timer_create - convenience function to create TYPE_CMSDK_APB_= TIMER - * @addr: location in system memory to map registers - * @pclk_frq: frequency in Hz of the PCLK clock (used for calculating baud= rate) - */ -static inline DeviceState *cmsdk_apb_timer_create(hwaddr addr, - qemu_irq timerint, - uint32_t pclk_frq) -{ - DeviceState *dev; - SysBusDevice *s; - - dev =3D qdev_new(TYPE_CMSDK_APB_TIMER); - s =3D SYS_BUS_DEVICE(dev); - qdev_prop_set_uint32(dev, "pclk-frq", pclk_frq); - sysbus_realize_and_unref(s, &error_fatal); - sysbus_mmio_map(s, 0, addr); - sysbus_connect_irq(s, 0, timerint); - return dev; -} - #endif diff --git a/hw/arm/mps2.c b/hw/arm/mps2.c index 9a8b23c64ce..f762d1b46af 100644 --- a/hw/arm/mps2.c +++ b/hw/arm/mps2.c @@ -83,6 +83,7 @@ struct MPS2MachineState { /* CMSDK APB subsystem */ CMSDKAPBDualTimer dualtimer; CMSDKAPBWatchdog watchdog; + CMSDKAPBTimer timer[2]; }; =20 #define TYPE_MPS2_MACHINE "mps2" @@ -330,8 +331,21 @@ static void mps2_common_init(MachineState *machine) } =20 /* CMSDK APB subsystem */ - cmsdk_apb_timer_create(0x40000000, qdev_get_gpio_in(armv7m, 8), SYSCLK= _FRQ); - cmsdk_apb_timer_create(0x40001000, qdev_get_gpio_in(armv7m, 9), SYSCLK= _FRQ); + for (i =3D 0; i < ARRAY_SIZE(mms->timer); i++) { + g_autofree char *name =3D g_strdup_printf("timer%d", i); + hwaddr base =3D 0x40000000 + i * 0x1000; + int irqno =3D 8 + i; + SysBusDevice *sbd; + + object_initialize_child(OBJECT(mms), name, &mms->timer[i], + TYPE_CMSDK_APB_TIMER); + sbd =3D SYS_BUS_DEVICE(&mms->timer[i]); + qdev_prop_set_uint32(DEVICE(&mms->timer[i]), "pclk-frq", SYSCLK_FR= Q); + sysbus_realize_and_unref(sbd, &error_fatal); + sysbus_mmio_map(sbd, 0, base); + sysbus_connect_irq(sbd, 0, qdev_get_gpio_in(armv7m, irqno)); + } + object_initialize_child(OBJECT(mms), "dualtimer", &mms->dualtimer, TYPE_CMSDK_APB_DUALTIMER); qdev_prop_set_uint32(DEVICE(&mms->dualtimer), "pclk-frq", SYSCLK_FRQ); --=20 2.20.1 From nobody Thu May 16 19:07:36 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1611919398; cv=none; d=zohomail.com; s=zohoarc; b=CXM9eQRt3amimi2C83Ifr3r4AJL5tTQLvNP1GhohgqGwmVhDsH8EwkQhH8FMSiuk+uYhNhEahejYxavXMlkdG8xwNFFGgFN3s0Kkln8WSn/4bP5OEdu09K0aahCWfeF5CuzWOvqlf0QICsw1iQYVxYaaH4rEWwjYjKd0jBjehjE= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1611919398; h=Content-Type:Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=LCpT729Mo0phwrHmAvYq3gK+eaezJmdIk0vAwi0ZpHM=; b=gPEFJSGk3d6OiY4rONbrsUf8DE5ROl845kgHwjIwXNg4a4XV9iwzYUyd+FmOoMQTIDx5mIYbmt+zdROZW+ljvNp4IUvc+sh8I9wvkCm6ehwhAFmNYBlN8zAt0JoBq76rwI3eGCZSKZvwpJdICGfxZF47x1J9d01znRy8fjkSnNw= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1611919398004154.9036529397398; Fri, 29 Jan 2021 03:23:18 -0800 (PST) Received: from localhost ([::1]:46792 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1l5Rrw-0000fX-Rz for importer@patchew.org; Fri, 29 Jan 2021 06:23:16 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:60012) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1l5RWJ-00050r-Ty for qemu-devel@nongnu.org; Fri, 29 Jan 2021 06:00:55 -0500 Received: from mail-wr1-x42f.google.com ([2a00:1450:4864:20::42f]:38993) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1l5RWA-00076w-Rb for qemu-devel@nongnu.org; Fri, 29 Jan 2021 06:00:55 -0500 Received: by mail-wr1-x42f.google.com with SMTP id a1so8416629wrq.6 for ; Fri, 29 Jan 2021 03:00:46 -0800 (PST) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [81.2.115.148]) by smtp.gmail.com with ESMTPSA id w20sm9268761wmm.12.2021.01.29.03.00.44 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 29 Jan 2021 03:00:45 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:subject:date:message-id:in-reply-to:references:mime-version :content-transfer-encoding; bh=LCpT729Mo0phwrHmAvYq3gK+eaezJmdIk0vAwi0ZpHM=; b=KsXSPRZ1ws/4SjflUFgkc9xYeV0HH9GdwYZzs2OEEB/3cuA1ANg9yweOdyrS92WBaL GWdDbpD+K0Ww7HFRKER1a5keIF9JFxijG7B6RrIsajKBgZ512UYSPoNCvrNNjsOJFpik U2mTug+5oDDEGQJmKPzx8aUF5LsoDkFIp2IOFQTTxQmbVxd/RKR4I6i5SdaUHvVAzb+T PmQ+VHGZ9gjRng6SSFlxSbWk+uoeN5BGt1n0siQoFm0haUSfo2aM/7YyiHpNIKF3N3le IrV9w2IsIcpXYSZLifQAsUiouFdTEDsr6DlAPnB3YsVPYbSVtBa1J/hlVrBiqs9qnKwh RRmA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=LCpT729Mo0phwrHmAvYq3gK+eaezJmdIk0vAwi0ZpHM=; b=YhhvVZnV5kNFe78p/twn3hbUr4l8anz2iASsdcNKITsV1BFplhiqsHZCih4P/mu6se Gd3ZJlYqrWvFB5BtypbzrT4nXE9rwRWWG+b5kcvk445/z9bskFVzykThqXtzK3keKFKh DLibBZtjVe93jT6+kA4XocOf4Fh2ZSrqzBVeh/C8oC6IsRBHF1hVrLnPFFbNFGwvBgkM CpsV4+oR3US56/CrUVsSyjh4Cg5ycdmtHpulylmNZTlABa47Tj6r5uQUmopZM+D9L5QD ZA0CuLqFu52lTUColpQqr2aG11Ilq/C5WAAyjt4OXiB6kkXppGxG227/uZJLrshOOLCm D25Q== X-Gm-Message-State: AOAM533dgpcjrA2p+jqR0GHoRWbXyyBw9LxD/HVX3OuA5BP/rl2k7xxO a6ocP7FOsrxd1RZMU2xjnuC8pKDv4z3nmg== X-Google-Smtp-Source: ABdhPJxN24VGyvBVEkIsxdd7XkxuiO1jYPu5F+c2MgMWc+Qj4b/rpcUFdEu4BKcbQvz6lcdcUYHOiA== X-Received: by 2002:adf:df0a:: with SMTP id y10mr3900718wrl.214.1611918045480; Fri, 29 Jan 2021 03:00:45 -0800 (PST) From: Peter Maydell To: qemu-devel@nongnu.org Subject: [PULL 34/46] hw/arm/mps2: Create and connect SYSCLK Clock Date: Fri, 29 Jan 2021 11:00:00 +0000 Message-Id: <20210129110012.8660-35-peter.maydell@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20210129110012.8660-1-peter.maydell@linaro.org> References: <20210129110012.8660-1-peter.maydell@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2a00:1450:4864:20::42f; envelope-from=peter.maydell@linaro.org; helo=mail-wr1-x42f.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.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @linaro.org) Create a fixed-frequency Clock object to be the SYSCLK, and wire it up to the devices that require it. Signed-off-by: Peter Maydell Reviewed-by: Philippe Mathieu-Daud=C3=A9 Reviewed-by: Luc Michel Tested-by: Philippe Mathieu-Daud=C3=A9 Message-id: 20210128114145.20536-14-peter.maydell@linaro.org Message-id: 20210121190622.22000-14-peter.maydell@linaro.org --- hw/arm/mps2.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/hw/arm/mps2.c b/hw/arm/mps2.c index f762d1b46af..cd1c215f941 100644 --- a/hw/arm/mps2.c +++ b/hw/arm/mps2.c @@ -46,6 +46,7 @@ #include "hw/net/lan9118.h" #include "net/net.h" #include "hw/watchdog/cmsdk-apb-watchdog.h" +#include "hw/qdev-clock.h" #include "qom/object.h" =20 typedef enum MPS2FPGAType { @@ -84,6 +85,7 @@ struct MPS2MachineState { CMSDKAPBDualTimer dualtimer; CMSDKAPBWatchdog watchdog; CMSDKAPBTimer timer[2]; + Clock *sysclk; }; =20 #define TYPE_MPS2_MACHINE "mps2" @@ -140,6 +142,10 @@ static void mps2_common_init(MachineState *machine) exit(EXIT_FAILURE); } =20 + /* This clock doesn't need migration because it is fixed-frequency */ + mms->sysclk =3D clock_new(OBJECT(machine), "SYSCLK"); + clock_set_hz(mms->sysclk, SYSCLK_FRQ); + /* The FPGA images have an odd combination of different RAMs, * because in hardware they are different implementations and * connected to different buses, giving varying performance/size @@ -341,6 +347,7 @@ static void mps2_common_init(MachineState *machine) TYPE_CMSDK_APB_TIMER); sbd =3D SYS_BUS_DEVICE(&mms->timer[i]); qdev_prop_set_uint32(DEVICE(&mms->timer[i]), "pclk-frq", SYSCLK_FR= Q); + qdev_connect_clock_in(DEVICE(&mms->timer[i]), "pclk", mms->sysclk); sysbus_realize_and_unref(sbd, &error_fatal); sysbus_mmio_map(sbd, 0, base); sysbus_connect_irq(sbd, 0, qdev_get_gpio_in(armv7m, irqno)); @@ -349,6 +356,7 @@ static void mps2_common_init(MachineState *machine) object_initialize_child(OBJECT(mms), "dualtimer", &mms->dualtimer, TYPE_CMSDK_APB_DUALTIMER); qdev_prop_set_uint32(DEVICE(&mms->dualtimer), "pclk-frq", SYSCLK_FRQ); + qdev_connect_clock_in(DEVICE(&mms->dualtimer), "TIMCLK", mms->sysclk); sysbus_realize(SYS_BUS_DEVICE(&mms->dualtimer), &error_fatal); sysbus_connect_irq(SYS_BUS_DEVICE(&mms->dualtimer), 0, qdev_get_gpio_in(armv7m, 10)); @@ -356,6 +364,7 @@ static void mps2_common_init(MachineState *machine) object_initialize_child(OBJECT(mms), "watchdog", &mms->watchdog, TYPE_CMSDK_APB_WATCHDOG); qdev_prop_set_uint32(DEVICE(&mms->watchdog), "wdogclk-frq", SYSCLK_FRQ= ); + qdev_connect_clock_in(DEVICE(&mms->watchdog), "WDOGCLK", mms->sysclk); sysbus_realize(SYS_BUS_DEVICE(&mms->watchdog), &error_fatal); sysbus_connect_irq(SYS_BUS_DEVICE(&mms->watchdog), 0, qdev_get_gpio_in_named(armv7m, "NMI", 0)); --=20 2.20.1 From nobody Thu May 16 19:07:36 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1611919652; cv=none; d=zohomail.com; s=zohoarc; b=ErHgI67kVXXSmOR3FT5C6jrXKPPitfje93kZOYvJasvf9Ub0SgvbYt3amhjA4FaqTp6K6s6ICkO/yvr3sA5jh0vK6RPrbUixbjMTiTs/4TNmtocbffa2DUe2QWXYEZekaPp/BFQnKjFCl0rnWOge90oj+vBDV7yHIsyrmNCqD7g= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1611919652; h=Content-Type:Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=CihYkdqAOfQwaocMGopB4Hac7Q9aRPC7UvcMr3MNgrY=; b=H/Cgh0MaYGUCjX6O1Ilyf/+XY9L/cc8Qml4vReA5Celaazo9hZJbc/+Ptl12YG/giErDuIt2B/aLwWDgqGq1amqFzU6ch0IGF5aksCiHmvCBsXpewj9IxOlFdwWVFapC/NKe8sUbDJSNm6C4MN0FmXgCn1RxO07ObeTlbhgj67Y= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1611919652394774.1853609326157; Fri, 29 Jan 2021 03:27:32 -0800 (PST) Received: from localhost ([::1]:60476 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1l5Rw2-0006D6-MS for importer@patchew.org; Fri, 29 Jan 2021 06:27:30 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:60048) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1l5RWK-00052l-Vr for qemu-devel@nongnu.org; Fri, 29 Jan 2021 06:00:57 -0500 Received: from mail-wr1-x429.google.com ([2a00:1450:4864:20::429]:43312) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1l5RWB-000777-OL for qemu-devel@nongnu.org; Fri, 29 Jan 2021 06:00:56 -0500 Received: by mail-wr1-x429.google.com with SMTP id z6so8340420wrq.10 for ; Fri, 29 Jan 2021 03:00:47 -0800 (PST) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [81.2.115.148]) by smtp.gmail.com with ESMTPSA id w20sm9268761wmm.12.2021.01.29.03.00.45 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 29 Jan 2021 03:00:45 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:subject:date:message-id:in-reply-to:references:mime-version :content-transfer-encoding; bh=CihYkdqAOfQwaocMGopB4Hac7Q9aRPC7UvcMr3MNgrY=; b=nEMnfzDnSh5bMnZ/bFq6ijVHflKOR2UyHnKSYZDh7aoIitgAqGuQFg6A3JevFJFd1h iC61HByDuwjDtUS0cplY/ca5hKoXi2wcZ5imZpCD5oJKUPtPYwZwB8euXLl7VHGrtRDm 4FQbes0fQroiNRpsnNotnc/1BAszVbrHm2wZ4x05UeVH+jVtau8hzDzx/Eg5BnM5+m0N C+qv4aucXGI8EHuY9rfj1eAlHNGRHHndO/jnFecx7lZXpl8TjxTmXPm/J0pEUjeeNzjG QbOix6BTL3s58KPF31okKYSf185vul/5o217gONOqcmNU+m2O1ioP1Kbb/l4jU7suHY0 fetw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=CihYkdqAOfQwaocMGopB4Hac7Q9aRPC7UvcMr3MNgrY=; b=Homh4ieQZZqBu8dzVx2nA4aqmmvcQryWvF+3kb4d82aAjB/cDejox/oh1K3OqxCAlK qPbRDE1s/WmYv7qB29T8idWlzA1tOVHwihZup/jW4Opj36AI+RTpszhrTkMqN9Ztd67M gOS8+/Bwwh7Oo3uuBhE6f8MsNosH+bwacdkfVs5sDf7iui8js8B4qlzA4reKOJcIJiYe Gxtu587k01UQrGGwDXVCJvLZlFMfVk/Nls9zAUw0uXvmlb6tJ8fQXJOYwAVpzWUnmyJ/ Egx2OTyaK98D0xKMb1bWEmGuH7+07x5exIukfJ0DQLElmoDfUSszypcQrP5xC20uIoUp kPvQ== X-Gm-Message-State: AOAM531s7LPGPKr5WNLYxEECsLGiXeVWA/+0ScLuoIgBKI5kGlALSdWb kqR3G7K9ZLtoeE9ZvAFMXuZewqF9Xwd5EQ== X-Google-Smtp-Source: ABdhPJxXOLIUQgISM68fyEuho/uCeeNk20awd6rTg7o2qpO3aV8oRHzB2dXkyWuW5bTv5wVgb5hnVw== X-Received: by 2002:adf:e80f:: with SMTP id o15mr3875134wrm.366.1611918046339; Fri, 29 Jan 2021 03:00:46 -0800 (PST) From: Peter Maydell To: qemu-devel@nongnu.org Subject: [PULL 35/46] hw/arm/mps2-tz: Create and connect ARMSSE Clocks Date: Fri, 29 Jan 2021 11:00:01 +0000 Message-Id: <20210129110012.8660-36-peter.maydell@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20210129110012.8660-1-peter.maydell@linaro.org> References: <20210129110012.8660-1-peter.maydell@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2a00:1450:4864:20::429; envelope-from=peter.maydell@linaro.org; helo=mail-wr1-x429.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.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @linaro.org) Create and connect the two clocks needed by the ARMSSE. Signed-off-by: Peter Maydell Reviewed-by: Philippe Mathieu-Daud=C3=A9 Reviewed-by: Luc Michel Tested-by: Philippe Mathieu-Daud=C3=A9 Message-id: 20210128114145.20536-15-peter.maydell@linaro.org Message-id: 20210121190622.22000-15-peter.maydell@linaro.org --- hw/arm/mps2-tz.c | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/hw/arm/mps2-tz.c b/hw/arm/mps2-tz.c index 6a9eed9022a..7acdf490f28 100644 --- a/hw/arm/mps2-tz.c +++ b/hw/arm/mps2-tz.c @@ -62,6 +62,7 @@ #include "hw/net/lan9118.h" #include "net/net.h" #include "hw/core/split-irq.h" +#include "hw/qdev-clock.h" #include "qom/object.h" =20 #define MPS2TZ_NUMIRQ 92 @@ -100,6 +101,8 @@ struct MPS2TZMachineState { qemu_or_irq uart_irq_orgate; DeviceState *lan9118; SplitIRQ cpu_irq_splitter[MPS2TZ_NUMIRQ]; + Clock *sysclk; + Clock *s32kclk; }; =20 #define TYPE_MPS2TZ_MACHINE "mps2tz" @@ -110,6 +113,8 @@ OBJECT_DECLARE_TYPE(MPS2TZMachineState, MPS2TZMachineCl= ass, MPS2TZ_MACHINE) =20 /* Main SYSCLK frequency in Hz */ #define SYSCLK_FRQ 20000000 +/* Slow 32Khz S32KCLK frequency in Hz */ +#define S32KCLK_FRQ (32 * 1000) =20 /* Create an alias of an entire original MemoryRegion @orig * located at @base in the memory map. @@ -396,6 +401,12 @@ static void mps2tz_common_init(MachineState *machine) exit(EXIT_FAILURE); } =20 + /* These clocks don't need migration because they are fixed-frequency = */ + mms->sysclk =3D clock_new(OBJECT(machine), "SYSCLK"); + clock_set_hz(mms->sysclk, SYSCLK_FRQ); + mms->s32kclk =3D clock_new(OBJECT(machine), "S32KCLK"); + clock_set_hz(mms->s32kclk, S32KCLK_FRQ); + object_initialize_child(OBJECT(machine), TYPE_IOTKIT, &mms->iotkit, mmc->armsse_type); iotkitdev =3D DEVICE(&mms->iotkit); @@ -403,6 +414,8 @@ static void mps2tz_common_init(MachineState *machine) OBJECT(system_memory), &error_abort); qdev_prop_set_uint32(iotkitdev, "EXP_NUMIRQ", MPS2TZ_NUMIRQ); qdev_prop_set_uint32(iotkitdev, "MAINCLK_FRQ", SYSCLK_FRQ); + qdev_connect_clock_in(iotkitdev, "MAINCLK", mms->sysclk); + qdev_connect_clock_in(iotkitdev, "S32KCLK", mms->s32kclk); sysbus_realize(SYS_BUS_DEVICE(&mms->iotkit), &error_fatal); =20 /* --=20 2.20.1 From nobody Thu May 16 19:07:36 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1611919512; cv=none; d=zohomail.com; s=zohoarc; b=HOSup82OJDyzG3qJZ5L9rbg3Dc71M5VvBL+v46lYgyfqF1HKdYrYjBHEpC9DivX3k7ei29V9DUuAVzLojINC244vkSQi5ufS05K2rf63M1btuKmSkvhAwHv8gRfFLIYldBumQlS6dePRsyFTEW4v/Sj960hg3NT2H4IMpM/0iEs= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1611919512; h=Content-Type:Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=RSDh1s4sSFCh+gnxQ/s51Xo8osmp4XAWuSEwUmDU5oQ=; b=Yxvma+R5MGMKwc4ta5pATSWFlRLsVS29qln9mxwJScUyu/GAYO8hUg0FPo5xC09QLCAXWDcEzUco0+GcadzYF4OMLYMgcZ1Fu+qzu55qmggjjf3UsUlr+9htm1b6yQg59kcU/G5YH4W1KshOKAp/cu1CthmKJ85WDmT90cAL2qg= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1611919512187401.788665456521; Fri, 29 Jan 2021 03:25:12 -0800 (PST) Received: from localhost ([::1]:55190 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1l5Rtm-00041D-UP for importer@patchew.org; Fri, 29 Jan 2021 06:25:10 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:60030) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1l5RWK-00052I-H2 for qemu-devel@nongnu.org; Fri, 29 Jan 2021 06:00:56 -0500 Received: from mail-wr1-x433.google.com ([2a00:1450:4864:20::433]:37926) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1l5RWC-00077E-HQ for qemu-devel@nongnu.org; Fri, 29 Jan 2021 06:00:56 -0500 Received: by mail-wr1-x433.google.com with SMTP id s7so5398738wru.5 for ; Fri, 29 Jan 2021 03:00:48 -0800 (PST) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [81.2.115.148]) by smtp.gmail.com with ESMTPSA id w20sm9268761wmm.12.2021.01.29.03.00.46 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 29 Jan 2021 03:00:46 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:subject:date:message-id:in-reply-to:references:mime-version :content-transfer-encoding; bh=RSDh1s4sSFCh+gnxQ/s51Xo8osmp4XAWuSEwUmDU5oQ=; b=APGvjMnzN200RLhTWMMWwRfp/V+G4o8hs3Rdu6eu80n8G+1TQbxNfcyEc7pS99xbXt WiDVaSkkRBEGfFe5zrMf9mVyA+FaLra7ChZsWqPJuVzVWS4Zpz+8VL2o2m2qDj6SdGjY iSM7WWerOBNcICUvsDhn+4la2mUMan4Y2l6yyo11bKt+giGrW5brjSMu/Bos+/ri8KJ+ 2oK7jZL4rzBQvnJc3LyBTg2f7d1I53N0kSksEeocZGLbn9/HjN9lTW04F425iL3J9OLt v+Oisu0gBKIcL/O1emq9oR+2cQJdeAYaBmBXyKKBcc54LlTwsdDAFhEPrwwinXYqMZC3 F2+g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=RSDh1s4sSFCh+gnxQ/s51Xo8osmp4XAWuSEwUmDU5oQ=; b=rphZPYpnUbce0jkNDgfEjz+Csby9e4i8rYi2P/msOQHpwTLh8pa+0bvT7VSAESjft+ WKBm40ubOwOkNiQBhymwjccrRukQAh27uzGCPIObfgl52gbUFpTO51gbkuc8k/9vG3gd uteuQYtWbDlBrys3nvg/H2sFxkxLB1xBmwpU0n8PTxJ4EtDqjeHHWZt0sF3jCQukrSy+ nFJfh6dz9YZv7cJaEAp7Rc9AOb9qFZEJfIwCQEBXniYvnYX7M05eEi9WBMkWRz+B8919 EI0q1+IWZ3X7/3Fib/vP/wYm4cUWOvwhvfZFcm/RWX2erCige5vkEk6DUb/mzLF1BOxL LDXA== X-Gm-Message-State: AOAM531EAR3h7vdIr0CkA4XLHvYxQu3EF4vKLKNcSgO/e5UbtEd/5Rpn PtRQTitA3HfIki/9F1nfdhWlZiC/qT94Cw== X-Google-Smtp-Source: ABdhPJylFr5y1nsBKgvY48SoCtKASw4BxLLeq/0q9KnZO0rNHSjX3pKfJ0CeTGi44D6mDi/fgxJMew== X-Received: by 2002:adf:ee0d:: with SMTP id y13mr3958394wrn.228.1611918047235; Fri, 29 Jan 2021 03:00:47 -0800 (PST) From: Peter Maydell To: qemu-devel@nongnu.org Subject: [PULL 36/46] hw/arm/musca: Create and connect ARMSSE Clocks Date: Fri, 29 Jan 2021 11:00:02 +0000 Message-Id: <20210129110012.8660-37-peter.maydell@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20210129110012.8660-1-peter.maydell@linaro.org> References: <20210129110012.8660-1-peter.maydell@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2a00:1450:4864:20::433; envelope-from=peter.maydell@linaro.org; helo=mail-wr1-x433.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.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @linaro.org) Create and connect the two clocks needed by the ARMSSE. Signed-off-by: Peter Maydell Reviewed-by: Philippe Mathieu-Daud=C3=A9 Reviewed-by: Luc Michel Tested-by: Philippe Mathieu-Daud=C3=A9 Message-id: 20210128114145.20536-16-peter.maydell@linaro.org Message-id: 20210121190622.22000-16-peter.maydell@linaro.org --- hw/arm/musca.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/hw/arm/musca.c b/hw/arm/musca.c index d82bef11cf2..a9292482a06 100644 --- a/hw/arm/musca.c +++ b/hw/arm/musca.c @@ -33,6 +33,7 @@ #include "hw/misc/tz-ppc.h" #include "hw/misc/unimp.h" #include "hw/rtc/pl031.h" +#include "hw/qdev-clock.h" #include "qom/object.h" =20 #define MUSCA_NUMIRQ_MAX 96 @@ -82,6 +83,8 @@ struct MuscaMachineState { UnimplementedDeviceState sdio; UnimplementedDeviceState gpio; UnimplementedDeviceState cryptoisland; + Clock *sysclk; + Clock *s32kclk; }; =20 #define TYPE_MUSCA_MACHINE "musca" @@ -96,6 +99,8 @@ OBJECT_DECLARE_TYPE(MuscaMachineState, MuscaMachineClass,= MUSCA_MACHINE) * don't model that in our SSE-200 model yet. */ #define SYSCLK_FRQ 40000000 +/* Slow 32Khz S32KCLK frequency in Hz */ +#define S32KCLK_FRQ (32 * 1000) =20 static qemu_irq get_sse_irq_in(MuscaMachineState *mms, int irqno) { @@ -367,6 +372,11 @@ static void musca_init(MachineState *machine) exit(1); } =20 + mms->sysclk =3D clock_new(OBJECT(machine), "SYSCLK"); + clock_set_hz(mms->sysclk, SYSCLK_FRQ); + mms->s32kclk =3D clock_new(OBJECT(machine), "S32KCLK"); + clock_set_hz(mms->s32kclk, S32KCLK_FRQ); + object_initialize_child(OBJECT(machine), "sse-200", &mms->sse, TYPE_SSE200); ssedev =3D DEVICE(&mms->sse); @@ -376,6 +386,8 @@ static void musca_init(MachineState *machine) qdev_prop_set_uint32(ssedev, "init-svtor", mmc->init_svtor); qdev_prop_set_uint32(ssedev, "SRAM_ADDR_WIDTH", mmc->sram_addr_width); qdev_prop_set_uint32(ssedev, "MAINCLK_FRQ", SYSCLK_FRQ); + qdev_connect_clock_in(ssedev, "MAINCLK", mms->sysclk); + qdev_connect_clock_in(ssedev, "S32KCLK", mms->s32kclk); /* * Musca-A takes the default SSE-200 FPU/DSP settings (ie no for * CPU0 and yes for CPU1); Musca-B1 explicitly enables them for CPU0. --=20 2.20.1 From nobody Thu May 16 19:07:36 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1611919704; cv=none; d=zohomail.com; s=zohoarc; b=Ljazqv3XoTmEA4wc7RyLy5PN41l0BjrD51s6Lhj/yYiTTf+ZtOoV8zEiUbtiCj+ZBD6NAExxvG/ckC7rAKrpABqoHU1+P3UMLpYHM00zHNext76lulUCPf7Ps2pdm/MiphFMpOjZwNNAm318qjVDWV7C2YpOYimanQTK+3OMOeo= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1611919704; h=Content-Type:Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=LdChXWvig4K9vtaYyGdJgouYmGk4finx7K8kf9XdaMA=; b=WIc6i3Zkv8mimrlhcpEE7KGfDiXtupvEJiHFa/9JJMtl4iUt5W1yhCNX8sWpCNfV/XcjsM76SFOcz4p82glPpvOVgcMMu4t5Dc+neGuTKE2St4T57ikQKn9NL0hVcJxWvuLPUGh5w9Zg1TMXb7Y0n3VBZRqLAlEPufD1JdKcjnw= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1611919704235927.3761867438952; Fri, 29 Jan 2021 03:28:24 -0800 (PST) Received: from localhost ([::1]:35164 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1l5Rwt-0007PB-3T for importer@patchew.org; Fri, 29 Jan 2021 06:28:23 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:60062) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1l5RWL-00053x-BE for qemu-devel@nongnu.org; Fri, 29 Jan 2021 06:00:57 -0500 Received: from mail-wr1-x430.google.com ([2a00:1450:4864:20::430]:47077) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1l5RWD-000780-Jt for qemu-devel@nongnu.org; Fri, 29 Jan 2021 06:00:57 -0500 Received: by mail-wr1-x430.google.com with SMTP id q7so8360965wre.13 for ; Fri, 29 Jan 2021 03:00:49 -0800 (PST) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [81.2.115.148]) by smtp.gmail.com with ESMTPSA id w20sm9268761wmm.12.2021.01.29.03.00.47 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 29 Jan 2021 03:00:47 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:subject:date:message-id:in-reply-to:references:mime-version :content-transfer-encoding; bh=LdChXWvig4K9vtaYyGdJgouYmGk4finx7K8kf9XdaMA=; b=vPnFOZxZBM4+56AfxqlxxEuzTeQlN7BUGSpGxP090NdxtfNBDSk9R4ULvAHd3/BcqL Vfsn1PFl67e9srnvBC/NCAaWSmvZCIYKqNmGg60cjWK1gPJ2BE78hKK6c5VqsYV+2O4R FdCO9K4w80Rs3DoBtvCM+B1nPutE2AabYMElQyBmw0z69H5Kb2sEsWo1uNAgdr4qIZgn fYDZm74uglhTXvm8Cq+eNQIO5te3l4hyegKO45cH/IY23Gv7TdBFbgHR2bLEUyxiZYNy 0SfOMm4mN9mej+2BqZlnERexh7TfBO3otCHU1LddKZaDckP1jmO1714t6s1rN/TKcNOZ NHag== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=LdChXWvig4K9vtaYyGdJgouYmGk4finx7K8kf9XdaMA=; b=bsE5XzdkFLfsBrcFUwPVkiA+fi4Lr1ihPnaTIPLs2IB+4rELW9adRI4AvJDdOc6PTn udn0I2EwR4P5hLTIgsKIJEyiWL5RTN/qGRfZfNzOmVVtGSIeBK9HNu6YLD4KubGVls8d rE+pPdEOe1U9ODqHyLgbQwzN/4GWukLLsPw57dhQ5bPdqBvHh6AhwvuX3tSyzVkbTKyR SpgERoHKzCAVXULTwoVY4/5oe6ibvwLBQDAe4K+AxmQMO8IrTvuSwfPFyrMwXa+WF9Yv kM4okAV5Ye3KUTUs1Ei7SHFFwMMmbUyyFDhHwSivmgdKj3tVvHma01/5ZH1FQ4RPYVCI mQqw== X-Gm-Message-State: AOAM533A/YgUat2PNIgKQfN4CjUKiWuPMdeyHX+xt2WAsQFdJfjNYbgf N9scZsSgF1FUNZBerh8ono5iRGmWJ/FLXA== X-Google-Smtp-Source: ABdhPJytgZevu1xoCnNasE5Jxpy7t4UuOYLLOi+JdeORZBH1vMqQ/hIQP3VWqtFgpubjjBTad94OgQ== X-Received: by 2002:adf:eb4e:: with SMTP id u14mr3884668wrn.99.1611918048091; Fri, 29 Jan 2021 03:00:48 -0800 (PST) From: Peter Maydell To: qemu-devel@nongnu.org Subject: [PULL 37/46] hw/arm/stellaris: Convert SSYS to QOM device Date: Fri, 29 Jan 2021 11:00:03 +0000 Message-Id: <20210129110012.8660-38-peter.maydell@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20210129110012.8660-1-peter.maydell@linaro.org> References: <20210129110012.8660-1-peter.maydell@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2a00:1450:4864:20::430; envelope-from=peter.maydell@linaro.org; helo=mail-wr1-x430.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.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @linaro.org) Convert the SSYS code in the Stellaris boards (which encapsulates the system registers) to a proper QOM device. This will provide us with somewhere to put the output Clock whose frequency depends on the setting of the PLL configuration registers. This is a migration compatibility break for lm3s811evb, lm3s6965evb. We use 3-phase reset here because the Clock will need to propagate its value in the hold phase. For the moment we reset the device during the board creation so that the system_clock_scale global gets set; this will be removed in a subsequent commit. Signed-off-by: Peter Maydell Reviewed-by: Luc Michel Tested-by: Philippe Mathieu-Daud=C3=A9 Reviewed-by: Philippe Mathieu-Daud=C3=A9 Message-id: 20210128114145.20536-17-peter.maydell@linaro.org Message-id: 20210121190622.22000-17-peter.maydell@linaro.org Reviewed-by: Philippe Mathieu-Daud=C3=A9 --- hw/arm/stellaris.c | 132 ++++++++++++++++++++++++++++++++++++--------- 1 file changed, 107 insertions(+), 25 deletions(-) diff --git a/hw/arm/stellaris.c b/hw/arm/stellaris.c index 652823195b1..0194ede2fe0 100644 --- a/hw/arm/stellaris.c +++ b/hw/arm/stellaris.c @@ -357,7 +357,12 @@ static void stellaris_gptm_realize(DeviceState *dev, E= rror **errp) =20 /* System controller. */ =20 -typedef struct { +#define TYPE_STELLARIS_SYS "stellaris-sys" +OBJECT_DECLARE_SIMPLE_TYPE(ssys_state, STELLARIS_SYS) + +struct ssys_state { + SysBusDevice parent_obj; + MemoryRegion iomem; uint32_t pborctl; uint32_t ldopctl; @@ -371,11 +376,18 @@ typedef struct { uint32_t dcgc[3]; uint32_t clkvclr; uint32_t ldoarst; + qemu_irq irq; + /* Properties (all read-only registers) */ uint32_t user0; uint32_t user1; - qemu_irq irq; - stellaris_board_info *board; -} ssys_state; + uint32_t did0; + uint32_t did1; + uint32_t dc0; + uint32_t dc1; + uint32_t dc2; + uint32_t dc3; + uint32_t dc4; +}; =20 static void ssys_update(ssys_state *s) { @@ -430,7 +442,7 @@ static uint32_t pllcfg_fury[16] =3D { =20 static int ssys_board_class(const ssys_state *s) { - uint32_t did0 =3D s->board->did0; + uint32_t did0 =3D s->did0; switch (did0 & DID0_VER_MASK) { case DID0_VER_0: return DID0_CLASS_SANDSTORM; @@ -456,19 +468,19 @@ static uint64_t ssys_read(void *opaque, hwaddr offset, =20 switch (offset) { case 0x000: /* DID0 */ - return s->board->did0; + return s->did0; case 0x004: /* DID1 */ - return s->board->did1; + return s->did1; case 0x008: /* DC0 */ - return s->board->dc0; + return s->dc0; case 0x010: /* DC1 */ - return s->board->dc1; + return s->dc1; case 0x014: /* DC2 */ - return s->board->dc2; + return s->dc2; case 0x018: /* DC3 */ - return s->board->dc3; + return s->dc3; case 0x01c: /* DC4 */ - return s->board->dc4; + return s->dc4; case 0x030: /* PBORCTL */ return s->pborctl; case 0x034: /* LDOPCTL */ @@ -646,9 +658,9 @@ static const MemoryRegionOps ssys_ops =3D { .endianness =3D DEVICE_NATIVE_ENDIAN, }; =20 -static void ssys_reset(void *opaque) +static void stellaris_sys_reset_enter(Object *obj, ResetType type) { - ssys_state *s =3D (ssys_state *)opaque; + ssys_state *s =3D STELLARIS_SYS(obj); =20 s->pborctl =3D 0x7ffd; s->rcc =3D 0x078e3ac0; @@ -661,9 +673,19 @@ static void ssys_reset(void *opaque) s->rcgc[0] =3D 1; s->scgc[0] =3D 1; s->dcgc[0] =3D 1; +} + +static void stellaris_sys_reset_hold(Object *obj) +{ + ssys_state *s =3D STELLARIS_SYS(obj); + ssys_calculate_system_clock(s); } =20 +static void stellaris_sys_reset_exit(Object *obj) +{ +} + static int stellaris_sys_post_load(void *opaque, int version_id) { ssys_state *s =3D opaque; @@ -695,27 +717,66 @@ static const VMStateDescription vmstate_stellaris_sys= =3D { } }; =20 +static Property stellaris_sys_properties[] =3D { + DEFINE_PROP_UINT32("user0", ssys_state, user0, 0), + DEFINE_PROP_UINT32("user1", ssys_state, user1, 0), + DEFINE_PROP_UINT32("did0", ssys_state, did0, 0), + DEFINE_PROP_UINT32("did1", ssys_state, did1, 0), + DEFINE_PROP_UINT32("dc0", ssys_state, dc0, 0), + DEFINE_PROP_UINT32("dc1", ssys_state, dc1, 0), + DEFINE_PROP_UINT32("dc2", ssys_state, dc2, 0), + DEFINE_PROP_UINT32("dc3", ssys_state, dc3, 0), + DEFINE_PROP_UINT32("dc4", ssys_state, dc4, 0), + DEFINE_PROP_END_OF_LIST() +}; + +static void stellaris_sys_instance_init(Object *obj) +{ + ssys_state *s =3D STELLARIS_SYS(obj); + SysBusDevice *sbd =3D SYS_BUS_DEVICE(s); + + memory_region_init_io(&s->iomem, obj, &ssys_ops, s, "ssys", 0x00001000= ); + sysbus_init_mmio(sbd, &s->iomem); + sysbus_init_irq(sbd, &s->irq); +} + static int stellaris_sys_init(uint32_t base, qemu_irq irq, stellaris_board_info * board, uint8_t *macaddr) { - ssys_state *s; + DeviceState *dev =3D qdev_new(TYPE_STELLARIS_SYS); + SysBusDevice *sbd =3D SYS_BUS_DEVICE(dev); =20 - s =3D g_new0(ssys_state, 1); - s->irq =3D irq; - s->board =3D board; /* Most devices come preprogrammed with a MAC address in the user data= . */ - s->user0 =3D macaddr[0] | (macaddr[1] << 8) | (macaddr[2] << 16); - s->user1 =3D macaddr[3] | (macaddr[4] << 8) | (macaddr[5] << 16); + qdev_prop_set_uint32(dev, "user0", + macaddr[0] | (macaddr[1] << 8) | (macaddr[2] << 1= 6)); + qdev_prop_set_uint32(dev, "user1", + macaddr[3] | (macaddr[4] << 8) | (macaddr[5] << 1= 6)); + qdev_prop_set_uint32(dev, "did0", board->did0); + qdev_prop_set_uint32(dev, "did1", board->did1); + qdev_prop_set_uint32(dev, "dc0", board->dc0); + qdev_prop_set_uint32(dev, "dc1", board->dc1); + qdev_prop_set_uint32(dev, "dc2", board->dc2); + qdev_prop_set_uint32(dev, "dc3", board->dc3); + qdev_prop_set_uint32(dev, "dc4", board->dc4); + + sysbus_realize_and_unref(sbd, &error_fatal); + sysbus_mmio_map(sbd, 0, base); + sysbus_connect_irq(sbd, 0, irq); + + /* + * Normally we should not be resetting devices like this during + * board creation. For the moment we need to do so, because + * system_clock_scale will only get set when the STELLARIS_SYS + * device is reset, and we need its initial value to pass to + * the watchdog device. This hack can be removed once the + * watchdog has been converted to use a Clock input instead. + */ + device_cold_reset(dev); =20 - memory_region_init_io(&s->iomem, NULL, &ssys_ops, s, "ssys", 0x0000100= 0); - memory_region_add_subregion(get_system_memory(), base, &s->iomem); - ssys_reset(s); - vmstate_register(NULL, VMSTATE_INSTANCE_ID_ANY, &vmstate_stellaris_sys= , s); return 0; } =20 - /* I2C controller. */ =20 #define TYPE_STELLARIS_I2C "stellaris-i2c" @@ -1553,11 +1614,32 @@ static const TypeInfo stellaris_adc_info =3D { .class_init =3D stellaris_adc_class_init, }; =20 +static void stellaris_sys_class_init(ObjectClass *klass, void *data) +{ + DeviceClass *dc =3D DEVICE_CLASS(klass); + ResettableClass *rc =3D RESETTABLE_CLASS(klass); + + dc->vmsd =3D &vmstate_stellaris_sys; + rc->phases.enter =3D stellaris_sys_reset_enter; + rc->phases.hold =3D stellaris_sys_reset_hold; + rc->phases.exit =3D stellaris_sys_reset_exit; + device_class_set_props(dc, stellaris_sys_properties); +} + +static const TypeInfo stellaris_sys_info =3D { + .name =3D TYPE_STELLARIS_SYS, + .parent =3D TYPE_SYS_BUS_DEVICE, + .instance_size =3D sizeof(ssys_state), + .instance_init =3D stellaris_sys_instance_init, + .class_init =3D stellaris_sys_class_init, +}; + static void stellaris_register_types(void) { type_register_static(&stellaris_i2c_info); type_register_static(&stellaris_gptm_info); type_register_static(&stellaris_adc_info); + type_register_static(&stellaris_sys_info); } =20 type_init(stellaris_register_types) --=20 2.20.1 From nobody Thu May 16 19:07:36 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1611919710; cv=none; d=zohomail.com; s=zohoarc; b=CZWod8E0SM4iZqESb5Wnlmj1ILZAC30QUxuEJzUIfu/p7ot05xnxeiTlF0gdokDp/NCAnzEqyUdET0q6CrLGJBiYPC4crkU1qDhimI7owNcVJo7d/qw67to2wBDKabvQal2C2Bxh7CqRNO177IHWeJNFukL9DmDEuuebSkT1HE8= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1611919710; h=Content-Type:Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=Hiys9yTl9d1GIkh5vAdAWK0KQwFE4Y4J7Jx5KpmZ6ZY=; b=SiPOV1mOtuiLathcJCDOdF5jsfl9WaqNOAFuaLutneC6WeGMHXkadKzb2UCTBz1oMj6F2YnfLd5yWNDSZPSEiNLwA1bejWJu1HJ9LQoopVqy38ir/eK0Cr8FPgodrilp9MNNqTOIZsmQq4cT+/wf4ex8w9MRyUXpVPvM5jAUACQ= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1611919710093433.5384927114683; Fri, 29 Jan 2021 03:28:30 -0800 (PST) Received: from localhost ([::1]:35524 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1l5Rwy-0007ZP-2H for importer@patchew.org; Fri, 29 Jan 2021 06:28:28 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:60072) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1l5RWL-00054m-PD for qemu-devel@nongnu.org; Fri, 29 Jan 2021 06:00:57 -0500 Received: from mail-wr1-x432.google.com ([2a00:1450:4864:20::432]:47079) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1l5RWE-00078T-CV for qemu-devel@nongnu.org; Fri, 29 Jan 2021 06:00:57 -0500 Received: by mail-wr1-x432.google.com with SMTP id q7so8361021wre.13 for ; Fri, 29 Jan 2021 03:00:49 -0800 (PST) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [81.2.115.148]) by smtp.gmail.com with ESMTPSA id w20sm9268761wmm.12.2021.01.29.03.00.48 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 29 Jan 2021 03:00:48 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:subject:date:message-id:in-reply-to:references:mime-version :content-transfer-encoding; bh=Hiys9yTl9d1GIkh5vAdAWK0KQwFE4Y4J7Jx5KpmZ6ZY=; b=RbNCod9bmsx6ZoNUr0lq+kM5D0xJKkKfSWuyireIDwIX+OY+ZPy09SrNbUQuxyarvq HVAsOaeDgGzwAx8x5Qsu969YbxWlzMOXE0HZHIOIA3sS/Vtimz7UG3tUeK9B1wZxZ5FN db5EymtTU/f1LysrcM3+9ZIiaCmLKIT5ygyS2di0b89L0i6szYbuMeyPXvUP5FxOrL7O nzlck48USuo55xmynn1T2blr9RpydZd7aR2tl/Pkljc2qc6uxqJLubW40JeNgU43GO/s pM1UmbTMMaJ2gUvZDbYxECC1pKgzBO+7glgQ55LhHIoa0KsDX3od+qwAGj9TqkaVJRQX ML6g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=Hiys9yTl9d1GIkh5vAdAWK0KQwFE4Y4J7Jx5KpmZ6ZY=; b=YDhTLM94hvCbYFJwh27hEWpDa5k7PS7/bq6YaABMPgj8aWjEnwy7QqxlxDWUZyFqGX aMt2uAbPds5yksTB9cDcfyVeP+Ls9Ntzqw9DzJ1F4uOnthqSPE1YHw5B4dom2FAfZTae fWlRAVEqUEWg7hTopk8ZOnh0LwOEUS/i/6Gl7qGVSnfXIyafDib7XI8yP6yj6r020nqF cDRYltb6jwuh5hS/sJzL0DPQT1IvSJqLOXuEmpOBIhZJD37F5hRLY9RfMdNAa1OXjHK+ jncnOBXyxHbLvy4rOBQjuM4zWVrrKORueLOgAdFlmkkkEn49YWswhhXWMG0pwWT7bz2M X28A== X-Gm-Message-State: AOAM533tmJaBOH6+hFpugaC4x8P44FC8I/RuivT2tkQb255p5FDvBe0i 8QrjRUNmGS3ns4g+RhHyv+LCUdlhrh9b+A== X-Google-Smtp-Source: ABdhPJxwt137JfmgWNO8ZOJ9QEgmphJNH/k9Lr/T04ZOgo5EgeQphW02qYxMJnPSKEojUHuUjFq3WA== X-Received: by 2002:a5d:6189:: with SMTP id j9mr3854874wru.256.1611918048979; Fri, 29 Jan 2021 03:00:48 -0800 (PST) From: Peter Maydell To: qemu-devel@nongnu.org Subject: [PULL 38/46] hw/arm/stellaris: Create Clock input for watchdog Date: Fri, 29 Jan 2021 11:00:04 +0000 Message-Id: <20210129110012.8660-39-peter.maydell@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20210129110012.8660-1-peter.maydell@linaro.org> References: <20210129110012.8660-1-peter.maydell@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2a00:1450:4864:20::432; envelope-from=peter.maydell@linaro.org; helo=mail-wr1-x432.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.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @linaro.org) Create and connect the Clock input for the watchdog device on the Stellaris boards. Because the Stellaris boards model the ability to change the clock rate by programming PLL registers, we have to create an output Clock on the ssys_state device and wire it up to the watchdog. Note that the old comment on ssys_calculate_system_clock() got the units wrong -- system_clock_scale is in nanoseconds, not milliseconds. Improve the commentary to clarify how we are calculating the period. Signed-off-by: Peter Maydell Reviewed-by: Luc Michel Tested-by: Philippe Mathieu-Daud=C3=A9 Reviewed-by: Philippe Mathieu-Daud=C3=A9 Message-id: 20210128114145.20536-18-peter.maydell@linaro.org Message-id: 20210121190622.22000-18-peter.maydell@linaro.org Reviewed-by: Philippe Mathieu-Daud=C3=A9 --- hw/arm/stellaris.c | 43 +++++++++++++++++++++++++++++++------------ 1 file changed, 31 insertions(+), 12 deletions(-) diff --git a/hw/arm/stellaris.c b/hw/arm/stellaris.c index 0194ede2fe0..9b67c739ef2 100644 --- a/hw/arm/stellaris.c +++ b/hw/arm/stellaris.c @@ -26,6 +26,7 @@ #include "hw/watchdog/cmsdk-apb-watchdog.h" #include "migration/vmstate.h" #include "hw/misc/unimp.h" +#include "hw/qdev-clock.h" #include "cpu.h" #include "qom/object.h" =20 @@ -377,6 +378,7 @@ struct ssys_state { uint32_t clkvclr; uint32_t ldoarst; qemu_irq irq; + Clock *sysclk; /* Properties (all read-only registers) */ uint32_t user0; uint32_t user1; @@ -555,15 +557,26 @@ static bool ssys_use_rcc2(ssys_state *s) } =20 /* - * Caculate the sys. clock period in ms. + * Calculate the system clock period. We only want to propagate + * this change to the rest of the system if we're not being called + * from migration post-load. */ -static void ssys_calculate_system_clock(ssys_state *s) +static void ssys_calculate_system_clock(ssys_state *s, bool propagate_cloc= k) { + /* + * SYSDIV field specifies divisor: 0 =3D=3D /1, 1 =3D=3D /2, etc. Inp= ut + * clock is 200MHz, which is a period of 5 ns. Dividing the clock + * frequency by X is the same as multiplying the period by X. + */ if (ssys_use_rcc2(s)) { system_clock_scale =3D 5 * (((s->rcc2 >> 23) & 0x3f) + 1); } else { system_clock_scale =3D 5 * (((s->rcc >> 23) & 0xf) + 1); } + clock_set_ns(s->sysclk, system_clock_scale); + if (propagate_clock) { + clock_propagate(s->sysclk); + } } =20 static void ssys_write(void *opaque, hwaddr offset, @@ -598,7 +611,7 @@ static void ssys_write(void *opaque, hwaddr offset, s->int_status |=3D (1 << 6); } s->rcc =3D value; - ssys_calculate_system_clock(s); + ssys_calculate_system_clock(s, true); break; case 0x070: /* RCC2 */ if (ssys_board_class(s) =3D=3D DID0_CLASS_SANDSTORM) { @@ -610,7 +623,7 @@ static void ssys_write(void *opaque, hwaddr offset, s->int_status |=3D (1 << 6); } s->rcc2 =3D value; - ssys_calculate_system_clock(s); + ssys_calculate_system_clock(s, true); break; case 0x100: /* RCGC0 */ s->rcgc[0] =3D value; @@ -679,7 +692,8 @@ static void stellaris_sys_reset_hold(Object *obj) { ssys_state *s =3D STELLARIS_SYS(obj); =20 - ssys_calculate_system_clock(s); + /* OK to propagate clocks from the hold phase */ + ssys_calculate_system_clock(s, true); } =20 static void stellaris_sys_reset_exit(Object *obj) @@ -690,7 +704,7 @@ static int stellaris_sys_post_load(void *opaque, int ve= rsion_id) { ssys_state *s =3D opaque; =20 - ssys_calculate_system_clock(s); + ssys_calculate_system_clock(s, false); =20 return 0; } @@ -713,6 +727,7 @@ static const VMStateDescription vmstate_stellaris_sys = =3D { VMSTATE_UINT32_ARRAY(dcgc, ssys_state, 3), VMSTATE_UINT32(clkvclr, ssys_state), VMSTATE_UINT32(ldoarst, ssys_state), + /* No field for sysclk -- handled in post-load instead */ VMSTATE_END_OF_LIST() } }; @@ -738,11 +753,12 @@ static void stellaris_sys_instance_init(Object *obj) memory_region_init_io(&s->iomem, obj, &ssys_ops, s, "ssys", 0x00001000= ); sysbus_init_mmio(sbd, &s->iomem); sysbus_init_irq(sbd, &s->irq); + s->sysclk =3D qdev_init_clock_out(DEVICE(s), "SYSCLK"); } =20 -static int stellaris_sys_init(uint32_t base, qemu_irq irq, - stellaris_board_info * board, - uint8_t *macaddr) +static DeviceState *stellaris_sys_init(uint32_t base, qemu_irq irq, + stellaris_board_info *board, + uint8_t *macaddr) { DeviceState *dev =3D qdev_new(TYPE_STELLARIS_SYS); SysBusDevice *sbd =3D SYS_BUS_DEVICE(dev); @@ -774,7 +790,7 @@ static int stellaris_sys_init(uint32_t base, qemu_irq i= rq, */ device_cold_reset(dev); =20 - return 0; + return dev; } =20 /* I2C controller. */ @@ -1341,6 +1357,7 @@ static void stellaris_init(MachineState *ms, stellari= s_board_info *board) int flash_size; I2CBus *i2c; DeviceState *dev; + DeviceState *ssys_dev; int i; int j; =20 @@ -1391,8 +1408,8 @@ static void stellaris_init(MachineState *ms, stellari= s_board_info *board) } } =20 - stellaris_sys_init(0x400fe000, qdev_get_gpio_in(nvic, 28), - board, nd_table[0].macaddr.a); + ssys_dev =3D stellaris_sys_init(0x400fe000, qdev_get_gpio_in(nvic, 28), + board, nd_table[0].macaddr.a); =20 =20 if (board->dc1 & (1 << 3)) { /* watchdog present */ @@ -1401,6 +1418,8 @@ static void stellaris_init(MachineState *ms, stellari= s_board_info *board) /* system_clock_scale is valid now */ uint32_t mainclk =3D NANOSECONDS_PER_SECOND / system_clock_scale; qdev_prop_set_uint32(dev, "wdogclk-frq", mainclk); + qdev_connect_clock_in(dev, "WDOGCLK", + qdev_get_clock_out(ssys_dev, "SYSCLK")); =20 sysbus_realize_and_unref(SYS_BUS_DEVICE(dev), &error_fatal); sysbus_mmio_map(SYS_BUS_DEVICE(dev), --=20 2.20.1 From nobody Thu May 16 19:07:36 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1611919914; cv=none; d=zohomail.com; s=zohoarc; b=g/hwZdTG/+m6Tn9vDNXYoSXV3V5Llxxs5D/LW+n0VJUOFPv8nE+1bLbd0gyyoTQuclkn3MrQhwrAF43VzlWVRaZEFQ1bshHeCfXmxHPR5Fek5rVH6s824GGzz64YoVovpg4r89aR6ws78XbO8RkXM7s/lwRRwr6HPYDJUOTyeRs= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1611919914; h=Content-Type:Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=8Q/Zx+LStNTVndvw6F2NG1TWQc+T3iIwGsQdHvDIx/0=; b=ETTeAMP1C6hRulmEyD+wTOrlF5yeULzWXhOfSEhQcIQGLLDIpnGMUEVXU3El1zMG5ryzpdp0v0PMEe9X8EVfaKc7Uq6cVuSQ7pchydX2qDkGHPAX0iPs3JYj7M8hgUQhtG27DGZ0RSWxut1LbrQZ3/cRJzhJnX0WlfrL0O2GHo4= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1611919914513698.6707745701246; Fri, 29 Jan 2021 03:31:54 -0800 (PST) Received: from localhost ([::1]:47980 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1l5S0H-0004Hs-AM for importer@patchew.org; Fri, 29 Jan 2021 06:31:53 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:60124) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1l5RWO-00059k-C4 for qemu-devel@nongnu.org; Fri, 29 Jan 2021 06:01:01 -0500 Received: from mail-wm1-x32c.google.com ([2a00:1450:4864:20::32c]:38032) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1l5RWF-00078t-3D for qemu-devel@nongnu.org; Fri, 29 Jan 2021 06:01:00 -0500 Received: by mail-wm1-x32c.google.com with SMTP id y187so6820757wmd.3 for ; Fri, 29 Jan 2021 03:00:50 -0800 (PST) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [81.2.115.148]) by smtp.gmail.com with ESMTPSA id w20sm9268761wmm.12.2021.01.29.03.00.49 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 29 Jan 2021 03:00:49 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:subject:date:message-id:in-reply-to:references:mime-version :content-transfer-encoding; bh=8Q/Zx+LStNTVndvw6F2NG1TWQc+T3iIwGsQdHvDIx/0=; b=HfVbjkYTzqbcX0nMRtcelGrLtq+CiluMFUEtWKKDx/xsGIeS73m/o2+OzMITHKnYZv atNlTGaYDOvdlc0eXPPWkSjMeC2rul4EBfyGSJWoO7/z4O1eSNGcTBcjqtLFLgLDs0vZ 8dpmxbD3I0VseSmD3LZowQ6CWEr/FbFEceswHvCGTWRZQKkvoKXa1Eb0Tdm4ZJ8EdHw9 MnCjmG7lR9y7eBIMGWW0K6tnOkUwKe/ncfH0ks2mObTqWEfiI/9WGxf+HsJnxWV6ugUk XWd9XVN1ZTuDR7GVvHCF+WM37YxLYPZbtpwT0cAZ6bBO5FoOwpGejxfDpilv7shaKBA2 i05A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=8Q/Zx+LStNTVndvw6F2NG1TWQc+T3iIwGsQdHvDIx/0=; b=g9uN1K8BWnTjh2oS2jMu0qTRq0Vr5t9GSh/tGjQWn1aBwBFeresMnN9IWJsdiSxRnO elOy6mhGd3gFpzQcIQxe/MNYqfu6FxWmmjASxmKqXQkdFH1G1jKSKv86ufWKDKwTdQWT 27nJixbQfGT9bSnYq/I3RZPKtHtnmNnJNkcPPDCvY8ItJ8iUI88ESyEk68rI3j10rImr azhghdLcMTNjcWMO0+u9Rt8nMFMTWJVBiN7DRMBVxBbDfkBQME02QPK2k42h7GxfDcc3 b0stVbRS9AkYgKTbgP1p/tO0umMCBNHI/krKDBQoCBIssnHMMQJGbQaM9DXLxy1LEBv3 zkkg== X-Gm-Message-State: AOAM530RilXUEgfqZsembx1b1QF3iikAlRO8TpyAn8CzmuV5b6ZQko+g OmVdYq44ZlQvPNrJyIdawbCUmK8hkJZkNw== X-Google-Smtp-Source: ABdhPJz/JGrerkvSJ10iK1q7cjoJrgxOzb465Yz4qf71IfJcsG0b2WkpTdF5WDuC5OCKb0W5hmnCDw== X-Received: by 2002:a1c:1d12:: with SMTP id d18mr3160744wmd.121.1611918049784; Fri, 29 Jan 2021 03:00:49 -0800 (PST) From: Peter Maydell To: qemu-devel@nongnu.org Subject: [PULL 39/46] hw/timer/cmsdk-apb-timer: Convert to use Clock input Date: Fri, 29 Jan 2021 11:00:05 +0000 Message-Id: <20210129110012.8660-40-peter.maydell@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20210129110012.8660-1-peter.maydell@linaro.org> References: <20210129110012.8660-1-peter.maydell@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2a00:1450:4864:20::32c; envelope-from=peter.maydell@linaro.org; helo=mail-wm1-x32c.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.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @linaro.org) Switch the CMSDK APB timer device over to using its Clock input; the pclk-frq property is now ignored. Signed-off-by: Peter Maydell Reviewed-by: Philippe Mathieu-Daud=C3=A9 Reviewed-by: Luc Michel Tested-by: Philippe Mathieu-Daud=C3=A9 Message-id: 20210128114145.20536-19-peter.maydell@linaro.org Message-id: 20210121190622.22000-19-peter.maydell@linaro.org --- hw/timer/cmsdk-apb-timer.c | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/hw/timer/cmsdk-apb-timer.c b/hw/timer/cmsdk-apb-timer.c index c63145ff553..f053146d88f 100644 --- a/hw/timer/cmsdk-apb-timer.c +++ b/hw/timer/cmsdk-apb-timer.c @@ -204,6 +204,15 @@ static void cmsdk_apb_timer_reset(DeviceState *dev) ptimer_transaction_commit(s->timer); } =20 +static void cmsdk_apb_timer_clk_update(void *opaque) +{ + CMSDKAPBTimer *s =3D CMSDK_APB_TIMER(opaque); + + ptimer_transaction_begin(s->timer); + ptimer_set_period_from_clock(s->timer, s->pclk, 1); + ptimer_transaction_commit(s->timer); +} + static void cmsdk_apb_timer_init(Object *obj) { SysBusDevice *sbd =3D SYS_BUS_DEVICE(obj); @@ -213,15 +222,16 @@ static void cmsdk_apb_timer_init(Object *obj) s, "cmsdk-apb-timer", 0x1000); sysbus_init_mmio(sbd, &s->iomem); sysbus_init_irq(sbd, &s->timerint); - s->pclk =3D qdev_init_clock_in(DEVICE(s), "pclk", NULL, NULL); + s->pclk =3D qdev_init_clock_in(DEVICE(s), "pclk", + cmsdk_apb_timer_clk_update, s); } =20 static void cmsdk_apb_timer_realize(DeviceState *dev, Error **errp) { CMSDKAPBTimer *s =3D CMSDK_APB_TIMER(dev); =20 - if (s->pclk_frq =3D=3D 0) { - error_setg(errp, "CMSDK APB timer: pclk-frq property must be set"); + if (!clock_has_source(s->pclk)) { + error_setg(errp, "CMSDK APB timer: pclk clock must be connected"); return; } =20 @@ -232,7 +242,7 @@ static void cmsdk_apb_timer_realize(DeviceState *dev, E= rror **errp) PTIMER_POLICY_NO_COUNTER_ROUND_DOWN); =20 ptimer_transaction_begin(s->timer); - ptimer_set_freq(s->timer, s->pclk_frq); + ptimer_set_period_from_clock(s->timer, s->pclk, 1); ptimer_transaction_commit(s->timer); } =20 --=20 2.20.1 From nobody Thu May 16 19:07:36 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1611919769; cv=none; d=zohomail.com; s=zohoarc; b=GqtOMSxNqk7Ay7BxSedG9/+wIaRbMbo5h1Yf5hvuYfhnXcXpruZ22ETT3DPDDbbO4E5lddSYFJbFKe7q09f/E5xGGxazzFwt3yt/6hzOgnc0Lm5HNZLGoUAfa7DLSqzaC2mpRNg2bzL07OnfU46I24fDnkxo70zB3Q8RHHO6vhU= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1611919769; h=Content-Type:Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=fpGogSc9aL2sME+0A8VE5mo8u7gQQt71nHO/RA4JCro=; b=V0uqUFNCPlck2yhSuGa2qMk3HwR5lCIWQoFcdNgm9tqJQVwG0c4QH6qnYO2n37C2ykyoOrMFQt7QMBP2+hk6s69t5MpZAyMiWBO2GwFBv43UdB23zzBK3+dgUlqkH035LZNKaDkDSIIm2pYykn6dUn9i3jBgA1nKOCkh+iu5wRs= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 16119197693061008.5085432027299; Fri, 29 Jan 2021 03:29:29 -0800 (PST) Received: from localhost ([::1]:40702 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1l5Rxu-0001E4-7c for importer@patchew.org; Fri, 29 Jan 2021 06:29:26 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:60098) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1l5RWN-00058Q-8j for qemu-devel@nongnu.org; Fri, 29 Jan 2021 06:00:59 -0500 Received: from mail-wm1-x334.google.com ([2a00:1450:4864:20::334]:40711) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1l5RWG-000793-50 for qemu-devel@nongnu.org; Fri, 29 Jan 2021 06:00:58 -0500 Received: by mail-wm1-x334.google.com with SMTP id c127so6805307wmf.5 for ; Fri, 29 Jan 2021 03:00:51 -0800 (PST) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [81.2.115.148]) by smtp.gmail.com with ESMTPSA id w20sm9268761wmm.12.2021.01.29.03.00.49 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 29 Jan 2021 03:00:50 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:subject:date:message-id:in-reply-to:references:mime-version :content-transfer-encoding; bh=fpGogSc9aL2sME+0A8VE5mo8u7gQQt71nHO/RA4JCro=; b=OjTC12AN6aCjWuIdtFNz9doEDsgnhj4L6GRXUSzZZ7fN6kbUGz78IRpMt99THC5q9T t8oD2QHB9KnS/r9Vr3pluxZbSKyQmRVrkmmhV+q6/bP8K6QGDJ4uEv3xwRnsU+Q4EHUp oGY+V+ZHKILONA4El+2tm6gcqOFJ8X/7c6iaetLFk+KII6ii0GduEU3dIESr531g5eBm Wos6mt1euVPjxcTL0gHv8GJ4hkjQQzrjX+kw/ZHcaGPeaNnCQNiPAkVFduZWMiILtA03 FwAvZa+arTvcMFYd95xjkX/ZJNAhptDUHaI8/MRs0OGaugYmzxLpMndMuf3E5njb7aGO iMeA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=fpGogSc9aL2sME+0A8VE5mo8u7gQQt71nHO/RA4JCro=; b=tsj4VLTKh51JyDXnLfFXn39dJDuLpX7r5lGGRdl5gY6RN8AKsV5qmqkyUk9eM8QWhd zjfKU6WFY0rfeT5iWU8I7ETkuZdpQGOfSaYIck+q6juox+Np+eUePNnNHeYxOjaV4bhE av8sQN4sEtvKEctGavH62H3utUODPPp0yUsVVrmJdWoBYSlyIX42iEPmFCE/qHaF18EW MH/Y2+ujePINDEMH4KFAohWzCACOTGmjDSMS3Vg+sT7taFv6T0JPF83XfwRXUWxmQ2xB i+KXVf9rbB2HeDKy1wcZHgGoRck7csZugBmuanyHDwAGnxtHz3/7mRM+5D/f3r+eLCmd h6OQ== X-Gm-Message-State: AOAM532zS4TlJvv+cFUyVCL7y1OdzxpqDhPl+kTJEcidm1TX8HWrokX5 f08bCUmsbVlYw2CNL11sTDI/DsvmQJ8fmw== X-Google-Smtp-Source: ABdhPJys8QNNxB6THYo+u6ffEt4Lg/hY/Rr0Tes+AwVpV09lrmtj+fRYD59xoQHDxloPjatPbqcLfw== X-Received: by 2002:a7b:c854:: with SMTP id c20mr3178628wml.127.1611918050633; Fri, 29 Jan 2021 03:00:50 -0800 (PST) From: Peter Maydell To: qemu-devel@nongnu.org Subject: [PULL 40/46] hw/timer/cmsdk-apb-dualtimer: Convert to use Clock input Date: Fri, 29 Jan 2021 11:00:06 +0000 Message-Id: <20210129110012.8660-41-peter.maydell@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20210129110012.8660-1-peter.maydell@linaro.org> References: <20210129110012.8660-1-peter.maydell@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2a00:1450:4864:20::334; envelope-from=peter.maydell@linaro.org; helo=mail-wm1-x334.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.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @linaro.org) Switch the CMSDK APB dualtimer device over to using its Clock input; the pclk-frq property is now ignored. Signed-off-by: Peter Maydell Reviewed-by: Luc Michel Tested-by: Philippe Mathieu-Daud=C3=A9 Reviewed-by: Philippe Mathieu-Daud=C3=A9 Message-id: 20210128114145.20536-20-peter.maydell@linaro.org Message-id: 20210121190622.22000-20-peter.maydell@linaro.org Reviewed-by: Philippe Mathieu-Daud=C3=A9 --- hw/timer/cmsdk-apb-dualtimer.c | 42 ++++++++++++++++++++++++++++++---- 1 file changed, 37 insertions(+), 5 deletions(-) diff --git a/hw/timer/cmsdk-apb-dualtimer.c b/hw/timer/cmsdk-apb-dualtimer.c index 781b496037b..828127b366f 100644 --- a/hw/timer/cmsdk-apb-dualtimer.c +++ b/hw/timer/cmsdk-apb-dualtimer.c @@ -106,6 +106,22 @@ static void cmsdk_apb_dualtimer_update(CMSDKAPBDualTim= er *s) qemu_set_irq(s->timerintc, timintc); } =20 +static int cmsdk_dualtimermod_divisor(CMSDKAPBDualTimerModule *m) +{ + /* Return the divisor set by the current CONTROL.PRESCALE value */ + switch (FIELD_EX32(m->control, CONTROL, PRESCALE)) { + case 0: + return 1; + case 1: + return 16; + case 2: + case 3: /* UNDEFINED, we treat like 2 (and complained when it was set)= */ + return 256; + default: + g_assert_not_reached(); + } +} + static void cmsdk_dualtimermod_write_control(CMSDKAPBDualTimerModule *m, uint32_t newctrl) { @@ -146,7 +162,7 @@ static void cmsdk_dualtimermod_write_control(CMSDKAPBDu= alTimerModule *m, default: g_assert_not_reached(); } - ptimer_set_freq(m->timer, m->parent->pclk_frq / divisor); + ptimer_set_period_from_clock(m->timer, m->parent->timclk, divisor); } =20 if (changed & R_CONTROL_MODE_MASK) { @@ -414,7 +430,8 @@ static void cmsdk_dualtimermod_reset(CMSDKAPBDualTimerM= odule *m) * limit must both be set to 0xffff, so we wrap at 16 bits. */ ptimer_set_limit(m->timer, 0xffff, 1); - ptimer_set_freq(m->timer, m->parent->pclk_frq); + ptimer_set_period_from_clock(m->timer, m->parent->timclk, + cmsdk_dualtimermod_divisor(m)); ptimer_transaction_commit(m->timer); } =20 @@ -432,6 +449,20 @@ static void cmsdk_apb_dualtimer_reset(DeviceState *dev) s->timeritop =3D 0; } =20 +static void cmsdk_apb_dualtimer_clk_update(void *opaque) +{ + CMSDKAPBDualTimer *s =3D CMSDK_APB_DUALTIMER(opaque); + int i; + + for (i =3D 0; i < ARRAY_SIZE(s->timermod); i++) { + CMSDKAPBDualTimerModule *m =3D &s->timermod[i]; + ptimer_transaction_begin(m->timer); + ptimer_set_period_from_clock(m->timer, m->parent->timclk, + cmsdk_dualtimermod_divisor(m)); + ptimer_transaction_commit(m->timer); + } +} + static void cmsdk_apb_dualtimer_init(Object *obj) { SysBusDevice *sbd =3D SYS_BUS_DEVICE(obj); @@ -446,7 +477,8 @@ static void cmsdk_apb_dualtimer_init(Object *obj) for (i =3D 0; i < ARRAY_SIZE(s->timermod); i++) { sysbus_init_irq(sbd, &s->timermod[i].timerint); } - s->timclk =3D qdev_init_clock_in(DEVICE(s), "TIMCLK", NULL, NULL); + s->timclk =3D qdev_init_clock_in(DEVICE(s), "TIMCLK", + cmsdk_apb_dualtimer_clk_update, s); } =20 static void cmsdk_apb_dualtimer_realize(DeviceState *dev, Error **errp) @@ -454,8 +486,8 @@ static void cmsdk_apb_dualtimer_realize(DeviceState *de= v, Error **errp) CMSDKAPBDualTimer *s =3D CMSDK_APB_DUALTIMER(dev); int i; =20 - if (s->pclk_frq =3D=3D 0) { - error_setg(errp, "CMSDK APB timer: pclk-frq property must be set"); + if (!clock_has_source(s->timclk)) { + error_setg(errp, "CMSDK APB dualtimer: TIMCLK clock must be connec= ted"); return; } =20 --=20 2.20.1 From nobody Thu May 16 19:07:36 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1611919860; cv=none; d=zohomail.com; s=zohoarc; b=aWwT+zJ6a3yq9QCEkrB61HvmvM0KGBqEEFqJwkl+Iy8hGeFGyc91ODwx482QxsDs5vELsPQn7JLxTD7sjVZ6wOd3PCQPEnKrQfrGMfILT1HbaXTu6DjA8IzFClt/cMujKN4t0QYFzsNhfPgSxSY+2/drvFWcmvKzlBYuDeWTN9k= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1611919860; h=Content-Type:Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=R5ZCiCbzgcfVwbMTe2kDZcJL0TsUz0X/IGSllnBxFwk=; b=elVXZJjy7bqUpbKiHAbIC32vgqAKEGndueL748ljP9VzNrkPMwAPnok1IvKDJoTrLjK1rP/ZIAR6FQJkMJhoYqIC8N059E19fHO0mazARANWu2Z0zPt5baZi/Ex90ijRQFOeDUXRoFBJX22Nt4d30W8ti9OjPb3z2L5brd61jLU= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1611919860316190.99625368305828; Fri, 29 Jan 2021 03:31:00 -0800 (PST) Received: from localhost ([::1]:43984 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1l5RzP-0002YP-6b for importer@patchew.org; Fri, 29 Jan 2021 06:30:59 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:60094) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1l5RWM-00057n-Va for qemu-devel@nongnu.org; Fri, 29 Jan 2021 06:00:59 -0500 Received: from mail-wm1-x32a.google.com ([2a00:1450:4864:20::32a]:36438) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1l5RWH-00079I-13 for qemu-devel@nongnu.org; Fri, 29 Jan 2021 06:00:58 -0500 Received: by mail-wm1-x32a.google.com with SMTP id i9so6832697wmq.1 for ; Fri, 29 Jan 2021 03:00:52 -0800 (PST) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [81.2.115.148]) by smtp.gmail.com with ESMTPSA id w20sm9268761wmm.12.2021.01.29.03.00.50 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 29 Jan 2021 03:00:50 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:subject:date:message-id:in-reply-to:references:mime-version :content-transfer-encoding; bh=R5ZCiCbzgcfVwbMTe2kDZcJL0TsUz0X/IGSllnBxFwk=; b=AT3Zw4s7IQ+J6uq91qh3yDE91Fo8LgW7ipmi1gRDgE+UUkua3ElrKcyJMDsM4J0P+8 tIV+7dpL3D7UpaWdXUQVuyFr3GqP+rroSg2/wT66xX927Ow8f73WUij0FDrwS7FhLuxU kpgJOOC54PpBys6D6SR3+aZBDkdjQMAqQkSk/xVr3PUtKCbfeg8f6Ols5J/UKDfnM2xW jQiYrOEv+3fV2rJ2wLWOCXDzX5Dbzdl8h2kLxQo2pkZcRUFkNNPcxAxj4YG0lJ2JDYlG DFYZaeod79OumEfVNtz15Ulx8CBGlfT93S1DP4dy0jQsh0pqYjIM97SDmytq1aU2pRFR Z9+A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=R5ZCiCbzgcfVwbMTe2kDZcJL0TsUz0X/IGSllnBxFwk=; b=cFAxamEvVexO3rHw8bbqIcGgaddv/oBpCtF2RtFscHCJwNrcyRLb4nGG20QWDhO7mN RKo/k0rEV6UoigYOBWp6GD/Z1YFSDq88j60kfYvLoMvq/YFIZM6mCF64OZK4P+d0Uy3L 5Nla83ot4/dTVyKb5Xw8eDwly8OwDJBAgg98GTXhSlq5WeYTpLzd5eJEcNB1tvbj6rwW asJ0BWvaeIssTc+aQZLfZz37omPU+iXlhRtPZo6smvClgo07YmS8sxUs8uMXhf9YZuc+ ElxNzAGRhbWx2rGukEILZ6bmUwidqmnb/1BDJ4QosKTiXOouNA0M9ceL3CUqWjCY1Exd KFdw== X-Gm-Message-State: AOAM533IhECGGO6NmlwIoz+q/P12xiax8NKEqgFXP14eOSjsj99XE9C7 s2JpXVTwRT41ex3HlaHFK3EFq9m3etYqmA== X-Google-Smtp-Source: ABdhPJxyCVWKBQT0v5FEq9zT/SjdDeC3+FUt2vdFruFQ9KkALMDLXOLc3OOxM9bHf3+OTB0Dsk7WbQ== X-Received: by 2002:a05:600c:214c:: with SMTP id v12mr3276354wml.8.1611918051534; Fri, 29 Jan 2021 03:00:51 -0800 (PST) From: Peter Maydell To: qemu-devel@nongnu.org Subject: [PULL 41/46] hw/watchdog/cmsdk-apb-watchdog: Convert to use Clock input Date: Fri, 29 Jan 2021 11:00:07 +0000 Message-Id: <20210129110012.8660-42-peter.maydell@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20210129110012.8660-1-peter.maydell@linaro.org> References: <20210129110012.8660-1-peter.maydell@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2a00:1450:4864:20::32a; envelope-from=peter.maydell@linaro.org; helo=mail-wm1-x32a.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.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @linaro.org) Switch the CMSDK APB watchdog device over to using its Clock input; the wdogclk_frq property is now ignored. Signed-off-by: Peter Maydell Reviewed-by: Philippe Mathieu-Daud=C3=A9 Reviewed-by: Luc Michel Tested-by: Philippe Mathieu-Daud=C3=A9 Message-id: 20210128114145.20536-21-peter.maydell@linaro.org Message-id: 20210121190622.22000-21-peter.maydell@linaro.org --- hw/watchdog/cmsdk-apb-watchdog.c | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/hw/watchdog/cmsdk-apb-watchdog.c b/hw/watchdog/cmsdk-apb-watch= dog.c index b03bcb73628..9cad0c67da4 100644 --- a/hw/watchdog/cmsdk-apb-watchdog.c +++ b/hw/watchdog/cmsdk-apb-watchdog.c @@ -310,6 +310,15 @@ static void cmsdk_apb_watchdog_reset(DeviceState *dev) ptimer_transaction_commit(s->timer); } =20 +static void cmsdk_apb_watchdog_clk_update(void *opaque) +{ + CMSDKAPBWatchdog *s =3D CMSDK_APB_WATCHDOG(opaque); + + ptimer_transaction_begin(s->timer); + ptimer_set_period_from_clock(s->timer, s->wdogclk, 1); + ptimer_transaction_commit(s->timer); +} + static void cmsdk_apb_watchdog_init(Object *obj) { SysBusDevice *sbd =3D SYS_BUS_DEVICE(obj); @@ -319,7 +328,8 @@ static void cmsdk_apb_watchdog_init(Object *obj) s, "cmsdk-apb-watchdog", 0x1000); sysbus_init_mmio(sbd, &s->iomem); sysbus_init_irq(sbd, &s->wdogint); - s->wdogclk =3D qdev_init_clock_in(DEVICE(s), "WDOGCLK", NULL, NULL); + s->wdogclk =3D qdev_init_clock_in(DEVICE(s), "WDOGCLK", + cmsdk_apb_watchdog_clk_update, s); =20 s->is_luminary =3D false; s->id =3D cmsdk_apb_watchdog_id; @@ -329,9 +339,9 @@ static void cmsdk_apb_watchdog_realize(DeviceState *dev= , Error **errp) { CMSDKAPBWatchdog *s =3D CMSDK_APB_WATCHDOG(dev); =20 - if (s->wdogclk_frq =3D=3D 0) { + if (!clock_has_source(s->wdogclk)) { error_setg(errp, - "CMSDK APB watchdog: wdogclk-frq property must be set"); + "CMSDK APB watchdog: WDOGCLK clock must be connected"); return; } =20 @@ -342,7 +352,7 @@ static void cmsdk_apb_watchdog_realize(DeviceState *dev= , Error **errp) PTIMER_POLICY_NO_COUNTER_ROUND_DOWN); =20 ptimer_transaction_begin(s->timer); - ptimer_set_freq(s->timer, s->wdogclk_frq); + ptimer_set_period_from_clock(s->timer, s->wdogclk, 1); ptimer_transaction_commit(s->timer); } =20 --=20 2.20.1 From nobody Thu May 16 19:07:36 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1611919981; cv=none; d=zohomail.com; s=zohoarc; b=JwwM65CkgnQs07xETW2hvY7l0OYSSiJxW2xqLOTXX4/5UzrW/RvkpEGcC2Htiex/KRFaZ1iUAWfEMd4HEeCxkHnA/QdwDRbV/ckLA3RnTpagryw8BdZ+bq+D2IYYABTBApntTkjqM/n+q+icKcZ+hUwVXSiUIbZU65u2+AXSoQs= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1611919981; h=Content-Type:Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=I+7L5SpLExP6qZhOnla6nrvNT3mA6kf2oerfjRIUi8o=; b=AQg9kjRFm2q7JI+JTdpNHpA98sn2oaJ9c/KnDxqoB9sjgNOsttVGU+2AQQZrdvbShCEXzwGDZYzZ/NeNqEAsItSoHqorY+M9CT3NvKwKb3WCnzR7krl4vB4cjhwQIdt4TQHUSxHYsJKSX3VPj7gtWtF3yQnSjKjVEh1kt4eGFpg= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 161191998147396.75098854673763; Fri, 29 Jan 2021 03:33:01 -0800 (PST) Received: from localhost ([::1]:50448 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1l5S1M-0005Lf-9L for importer@patchew.org; Fri, 29 Jan 2021 06:33:00 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:60130) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1l5RWP-00059q-3t for qemu-devel@nongnu.org; Fri, 29 Jan 2021 06:01:01 -0500 Received: from mail-wm1-x32e.google.com ([2a00:1450:4864:20::32e]:36442) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1l5RWH-00079q-Sy for qemu-devel@nongnu.org; Fri, 29 Jan 2021 06:01:00 -0500 Received: by mail-wm1-x32e.google.com with SMTP id i9so6832745wmq.1 for ; Fri, 29 Jan 2021 03:00:53 -0800 (PST) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [81.2.115.148]) by smtp.gmail.com with ESMTPSA id w20sm9268761wmm.12.2021.01.29.03.00.51 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 29 Jan 2021 03:00:51 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:subject:date:message-id:in-reply-to:references:mime-version :content-transfer-encoding; bh=I+7L5SpLExP6qZhOnla6nrvNT3mA6kf2oerfjRIUi8o=; b=MjWu6j1J0olS5a4qfbUKDzDRHG3JdN4lzMRUNxPbMFp4e8J7mpzKNmpnu7t2X+QtFj AglvAyGCfGG3HQjfroATfz04UVoNHyLwKno4wnm6QhRxuGqTTOAMET2X0clXB1Dvux+f PvGo1rtBzWfqJm3fpwrh2oF916pOI2Ea2F6ieB56nAnJKNZKjQdlPgK+eLgpBBmVVIQe fG0obiChm8U+xRxiq+0Ev9jDSob32ddhtxRyU+v8nEXB6/Qm0nOWInmpNKbHMzuMeIx2 6xPrpTmZdTZiEH7HE7cKeahsG6ahUcuG+bpvThbM2P774Z7e2moBMroSbbbx5mfPumP+ X7vg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=I+7L5SpLExP6qZhOnla6nrvNT3mA6kf2oerfjRIUi8o=; b=n4iJGeTNWPTVjTPA2Lt3soGTXT3PSxPxfVwdRmDgdOFVJo1wksvWe2UXKVG4i2FJuy by0grMW3UPvp63ZQRu8x0ZS9b97FCC3pUVgkpxAlL96Bo2mkMSzo+Ubl8CHFwGawj+Hm LaQcNixINxhtWzMq83Dvm3a5C59RWKmCWhdoQhRzNQisTX+Ej7nnZer0lkm8xbpreK3+ nn9ltqNut90BgA9sFS0yT51RJEpXnw60q0eFCN7QthclsecgNahu/KOtndSecTWmniaq 5/IMmN6mqg3AEwfs4jTG0L7pbO20K2lNb/kaXbDGIWsNxWXocbNtRyiHACi9+RrZ3vb+ 4Ejg== X-Gm-Message-State: AOAM5322I6czn7/p6yOCYXZ9lPhV6NwlSs77la9bN6isuE6LJK5jz0jT Lw9tw2pTETuS7abmV/MFLFsF9jkChRitUA== X-Google-Smtp-Source: ABdhPJxo0iMrVWVGaYZkJtrCip4HS85qjVqZenTffKvwlPliF4jo6Cg2gVrKi+XfaSJNazZ9uyBCKA== X-Received: by 2002:a7b:c8c3:: with SMTP id f3mr3286643wml.110.1611918052432; Fri, 29 Jan 2021 03:00:52 -0800 (PST) From: Peter Maydell To: qemu-devel@nongnu.org Subject: [PULL 42/46] tests/qtest/cmsdk-apb-watchdog-test: Test clock changes Date: Fri, 29 Jan 2021 11:00:08 +0000 Message-Id: <20210129110012.8660-43-peter.maydell@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20210129110012.8660-1-peter.maydell@linaro.org> References: <20210129110012.8660-1-peter.maydell@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2a00:1450:4864:20::32e; envelope-from=peter.maydell@linaro.org; helo=mail-wm1-x32e.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.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @linaro.org) Now that the CMSDK APB watchdog uses its Clock input, it will correctly respond when the system clock frequency is changed using the RCC register on in the Stellaris board system registers. Test that when the RCC register is written it causes the watchdog timer to change speed. Signed-off-by: Peter Maydell Reviewed-by: Philippe Mathieu-Daud=C3=A9 Reviewed-by: Luc Michel Tested-by: Philippe Mathieu-Daud=C3=A9 Message-id: 20210128114145.20536-22-peter.maydell@linaro.org Message-id: 20210121190622.22000-22-peter.maydell@linaro.org --- tests/qtest/cmsdk-apb-watchdog-test.c | 52 +++++++++++++++++++++++++++ 1 file changed, 52 insertions(+) diff --git a/tests/qtest/cmsdk-apb-watchdog-test.c b/tests/qtest/cmsdk-apb-= watchdog-test.c index 950f64c527b..2710cb17b86 100644 --- a/tests/qtest/cmsdk-apb-watchdog-test.c +++ b/tests/qtest/cmsdk-apb-watchdog-test.c @@ -15,6 +15,7 @@ */ =20 #include "qemu/osdep.h" +#include "qemu/bitops.h" #include "libqtest-single.h" =20 /* @@ -31,6 +32,11 @@ #define WDOGMIS 0x14 #define WDOGLOCK 0xc00 =20 +#define SSYS_BASE 0x400fe000 +#define RCC 0x60 +#define SYSDIV_SHIFT 23 +#define SYSDIV_LENGTH 4 + static void test_watchdog(void) { g_assert_cmpuint(readl(WDOG_BASE + WDOGRIS), =3D=3D, 0); @@ -61,6 +67,50 @@ static void test_watchdog(void) g_assert_cmpuint(readl(WDOG_BASE + WDOGRIS), =3D=3D, 0); } =20 +static void test_clock_change(void) +{ + uint32_t rcc; + + /* + * Test that writing to the stellaris board's RCC register to + * change the system clock frequency causes the watchdog + * to change the speed it counts at. + */ + g_assert_cmpuint(readl(WDOG_BASE + WDOGRIS), =3D=3D, 0); + + writel(WDOG_BASE + WDOGCONTROL, 1); + writel(WDOG_BASE + WDOGLOAD, 1000); + + /* Step to just past the 500th tick */ + clock_step(80 * 500 + 1); + g_assert_cmpuint(readl(WDOG_BASE + WDOGRIS), =3D=3D, 0); + g_assert_cmpuint(readl(WDOG_BASE + WDOGVALUE), =3D=3D, 500); + + /* Rewrite RCC.SYSDIV from 16 to 8, so the clock is now 40ns per tick = */ + rcc =3D readl(SSYS_BASE + RCC); + g_assert_cmpuint(extract32(rcc, SYSDIV_SHIFT, SYSDIV_LENGTH), =3D=3D, = 0xf); + rcc =3D deposit32(rcc, SYSDIV_SHIFT, SYSDIV_LENGTH, 7); + writel(SSYS_BASE + RCC, rcc); + + /* Just past the 1000th tick: timer should have fired */ + clock_step(40 * 500); + g_assert_cmpuint(readl(WDOG_BASE + WDOGRIS), =3D=3D, 1); + + g_assert_cmpuint(readl(WDOG_BASE + WDOGVALUE), =3D=3D, 0); + + /* VALUE reloads at following tick */ + clock_step(41); + g_assert_cmpuint(readl(WDOG_BASE + WDOGVALUE), =3D=3D, 1000); + + /* Writing any value to WDOGINTCLR clears the interrupt and reloads */ + clock_step(40 * 500); + g_assert_cmpuint(readl(WDOG_BASE + WDOGVALUE), =3D=3D, 500); + g_assert_cmpuint(readl(WDOG_BASE + WDOGRIS), =3D=3D, 1); + writel(WDOG_BASE + WDOGINTCLR, 0); + g_assert_cmpuint(readl(WDOG_BASE + WDOGVALUE), =3D=3D, 1000); + g_assert_cmpuint(readl(WDOG_BASE + WDOGRIS), =3D=3D, 0); +} + int main(int argc, char **argv) { int r; @@ -70,6 +120,8 @@ int main(int argc, char **argv) qtest_start("-machine lm3s811evb"); =20 qtest_add_func("/cmsdk-apb-watchdog/watchdog", test_watchdog); + qtest_add_func("/cmsdk-apb-watchdog/watchdog_clock_change", + test_clock_change); =20 r =3D g_test_run(); =20 --=20 2.20.1 From nobody Thu May 16 19:07:36 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1611920361; cv=none; d=zohomail.com; s=zohoarc; b=N5eQLVEo6lOmz6RlV/AcRDvZSWm6/XYX0ysnoz+QhI/r1fGnU488TL2B0Kw0+slwGrwoXugpYBfTMB7m6GV0JcscIovF9YaiVCap7qb34sdjpxFJ+fn/JzfJJDGtJNzz+XJ4QefL2Osl/excvNPb6+rknupvr6yG9wBvLdX2T/I= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1611920361; h=Content-Type:Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=Nx8d60ny6nKbuq9bq2+Eyh9vShnK54u12FMGTPcmjio=; b=lCh6okGGBf2Yxy4xN1BkDkAObApoOVU97m2OFe7QG6qbKjMwxutd05caN6RY2CD5smcB/pSfuXl+0vy2pNQMdSa1XVJ9pU6vDnzq42m17W1SAjKnqWhDFykVCWAU/oCi8f3pnLzQqhj0gEPDA6EzTSWWUuNjnPplOSlhe1u54Ew= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1611920361124574.9113614351495; Fri, 29 Jan 2021 03:39:21 -0800 (PST) Received: from localhost ([::1]:43594 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1l5S7U-0005nm-3R for importer@patchew.org; Fri, 29 Jan 2021 06:39:20 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:60166) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1l5RWT-0005D7-M2 for qemu-devel@nongnu.org; Fri, 29 Jan 2021 06:01:09 -0500 Received: from mail-wm1-x333.google.com ([2a00:1450:4864:20::333]:35487) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1l5RWI-0007Aw-Nu for qemu-devel@nongnu.org; Fri, 29 Jan 2021 06:01:05 -0500 Received: by mail-wm1-x333.google.com with SMTP id e15so6819005wme.0 for ; Fri, 29 Jan 2021 03:00:54 -0800 (PST) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [81.2.115.148]) by smtp.gmail.com with ESMTPSA id w20sm9268761wmm.12.2021.01.29.03.00.52 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 29 Jan 2021 03:00:52 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:subject:date:message-id:in-reply-to:references:mime-version :content-transfer-encoding; bh=Nx8d60ny6nKbuq9bq2+Eyh9vShnK54u12FMGTPcmjio=; b=UER0xAbPQnKwozuxWtEq+u2ApL/fQSuYsXRUO762f5zOI84Li92/onfIJP9Zww8Yyv sLlHon6f9GVY+ixwnLNSZetIJk4sJnKNqv/6xYgAIp2wSxMtDe/nq256nn4LQR8Oqrkk +vKBlMxRlzrgO5scYWElKa6rDaR8Uj9Pl+9qiIACaVwBo31j1XRxVTOXnQj7XVcyv/PH xymfrp9hjm4YWst21rNCP7shCxHm0kwgSufe+ocqQiA3VrsKHRMuGZ8QIUdDDxToE0T/ D6fFWcWzF9tJdfdIsTfIs3PlNihlFLsJFxSw01jF8AsEBggpAMwzXAX8cCG+azB+en7s m/+w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=Nx8d60ny6nKbuq9bq2+Eyh9vShnK54u12FMGTPcmjio=; b=uNtXabGCJfU/gt4HZnIJr6ZKU9K7UB9roJ1piZ3c0NYwkHK7c+eIXFEIXb3ttIeweC lN17GVXkWIwnnVNxbTjHErBIYkoy1zMQAVgiVpml9Cc8G0glNL6JCaZ4uyL/i0opPVK/ 4gErrwcmY9m+oKI3g/C1F+ELWZYDiUJnryvicpYhDzobWXU7PSu77rFb71iv2UffHNBB aURZ/FXjkBlAgrI3UTBlAb+xByk3ql7b3U2I1zR6CYdbyGr437pVdIk3tDA6oRCUyU9a lZb3A2NhDDrdcc/EDmThDYt8SEZ1PQvLD2Cgw+aRZfGQ6IqRCWFJxJO/ml5O4JOsGUdm kROA== X-Gm-Message-State: AOAM533JVIGL7M8tJ/SnaDenMfWT6CWo5eso8YFZBjxvpEcPNmY9boyF Q/g7CDc5AHt1b1VBOtspXUwTplqVJ7dnUA== X-Google-Smtp-Source: ABdhPJzMTdU9NTotUDNiixlMvJc3hLq5//uqDYSOS8+6w9dlzfW+/LpdjzKi8NTneSFuVsXB1wUbrQ== X-Received: by 2002:a05:600c:4e8e:: with SMTP id f14mr3264039wmq.139.1611918053217; Fri, 29 Jan 2021 03:00:53 -0800 (PST) From: Peter Maydell To: qemu-devel@nongnu.org Subject: [PULL 43/46] hw/arm/armsse: Use Clock to set system_clock_scale Date: Fri, 29 Jan 2021 11:00:09 +0000 Message-Id: <20210129110012.8660-44-peter.maydell@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20210129110012.8660-1-peter.maydell@linaro.org> References: <20210129110012.8660-1-peter.maydell@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2a00:1450:4864:20::333; envelope-from=peter.maydell@linaro.org; helo=mail-wm1-x333.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.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @linaro.org) Use the MAINCLK Clock input to set the system_clock_scale variable rather than using the mainclk_frq property. Signed-off-by: Peter Maydell Reviewed-by: Philippe Mathieu-Daud=C3=A9 Tested-by: Philippe Mathieu-Daud=C3=A9 Reviewed-by: Luc Michel Message-id: 20210128114145.20536-23-peter.maydell@linaro.org Message-id: 20210121190622.22000-23-peter.maydell@linaro.org --- hw/arm/armsse.c | 24 +++++++++++++++++++----- 1 file changed, 19 insertions(+), 5 deletions(-) diff --git a/hw/arm/armsse.c b/hw/arm/armsse.c index 4349ce9bfdb..9a6b24c79aa 100644 --- a/hw/arm/armsse.c +++ b/hw/arm/armsse.c @@ -232,6 +232,16 @@ static void armsse_forward_sec_resp_cfg(ARMSSE *s) qdev_connect_gpio_out(dev_splitter, 2, s->sec_resp_cfg_in); } =20 +static void armsse_mainclk_update(void *opaque) +{ + ARMSSE *s =3D ARM_SSE(opaque); + /* + * Set system_clock_scale from our Clock input; this is what + * controls the tick rate of the CPU SysTick timer. + */ + system_clock_scale =3D clock_ticks_to_ns(s->mainclk, 1); +} + static void armsse_init(Object *obj) { ARMSSE *s =3D ARM_SSE(obj); @@ -242,7 +252,8 @@ static void armsse_init(Object *obj) assert(info->sram_banks <=3D MAX_SRAM_BANKS); assert(info->num_cpus <=3D SSE_MAX_CPUS); =20 - s->mainclk =3D qdev_init_clock_in(DEVICE(s), "MAINCLK", NULL, NULL); + s->mainclk =3D qdev_init_clock_in(DEVICE(s), "MAINCLK", + armsse_mainclk_update, s); s->s32kclk =3D qdev_init_clock_in(DEVICE(s), "S32KCLK", NULL, NULL); =20 memory_region_init(&s->container, obj, "armsse-container", UINT64_MAX); @@ -451,9 +462,11 @@ static void armsse_realize(DeviceState *dev, Error **e= rrp) return; } =20 - if (!s->mainclk_frq) { - error_setg(errp, "MAINCLK_FRQ property was not set"); - return; + if (!clock_has_source(s->mainclk)) { + error_setg(errp, "MAINCLK clock was not connected"); + } + if (!clock_has_source(s->s32kclk)) { + error_setg(errp, "S32KCLK clock was not connected"); } =20 assert(info->num_cpus <=3D SSE_MAX_CPUS); @@ -1115,7 +1128,8 @@ static void armsse_realize(DeviceState *dev, Error **= errp) */ sysbus_init_mmio(SYS_BUS_DEVICE(s), &s->container); =20 - system_clock_scale =3D NANOSECONDS_PER_SECOND / s->mainclk_frq; + /* Set initial system_clock_scale from MAINCLK */ + armsse_mainclk_update(s); } =20 static void armsse_idau_check(IDAUInterface *ii, uint32_t address, --=20 2.20.1 From nobody Thu May 16 19:07:36 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1611920055; cv=none; d=zohomail.com; s=zohoarc; b=SewzRhsDNebGwbVifaxGZF/z69gdzrLOf+4dclswucPkN1IjmQaWY0rOaO5mBh727R7FbRVkIWsfvktcg2QBC8n3uvoQ1NUCwl6pqrjgKGBAaLO45OfBhndFvxnTSt0dXFDnm5SpaIEBI2uamp8pgnnv5OFpAWfyAbUCn12wEoI= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1611920055; h=Content-Type:Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=vItLqJg/MtoIe02dX0vZeY+tc6nMRkWMUI4JyuPC8J0=; b=ghQYQHKkYA1qPgmUB9hJwjALm+V5DV3RpcrQ+tElvRdfDl+7790AGImPmmGIV1U2XFWyXmc6bIKqz3G9z8SLv4C+eTSL7HIutc3RKn3kcfBUtzNkpgbzBI6Z5c6GfjPtQzy1QjLKG9vBDxhSNVD7y0HTz5k4RrXPc7AKE8SWf6Y= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1611920055434185.08263706426987; Fri, 29 Jan 2021 03:34:15 -0800 (PST) Received: from localhost ([::1]:55890 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1l5S2W-0007ZZ-I5 for importer@patchew.org; Fri, 29 Jan 2021 06:34:12 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:60142) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1l5RWP-00059y-Ol for qemu-devel@nongnu.org; Fri, 29 Jan 2021 06:01:01 -0500 Received: from mail-wr1-x434.google.com ([2a00:1450:4864:20::434]:36771) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1l5RWJ-0007BB-V3 for qemu-devel@nongnu.org; Fri, 29 Jan 2021 06:01:01 -0500 Received: by mail-wr1-x434.google.com with SMTP id 6so8391589wri.3 for ; Fri, 29 Jan 2021 03:00:55 -0800 (PST) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [81.2.115.148]) by smtp.gmail.com with ESMTPSA id w20sm9268761wmm.12.2021.01.29.03.00.53 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 29 Jan 2021 03:00:53 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:subject:date:message-id:in-reply-to:references:mime-version :content-transfer-encoding; bh=vItLqJg/MtoIe02dX0vZeY+tc6nMRkWMUI4JyuPC8J0=; b=jDRhudn6lIsqgeQ4cbJSE9DWwnw6aHDZ54XzWd8aa8pdBbKo1finXSeTzs6P3GDLYl AmVhKwcN8weA801VlhIydJfoNzWULiwnq3gEDQG2wr5IIVK6UHiEjd+aCfGDLYZgTiyE BDz/BxCitb4CTLiVnVBgn+ZDAPO7Vw/P1Gn8fYFv7QwI14mmT2JfwHJ7b5yrT6uZ7+Bu x1QJ64n7AFqqcskwlY9N7LOQCiNsgcQSpm2Sqjuq5jtPJkKqID4qu6tWQJRfUQO4DG37 itNa7TMvbzYFxddgT8jJvDSzQzNzx/GKJIMPNVFn7o159MKm9Cl/3jR3+51j10R4M3Yz 8W5g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=vItLqJg/MtoIe02dX0vZeY+tc6nMRkWMUI4JyuPC8J0=; b=C4broX1SfYcO1hV9BCAhmbZKLxoxBxQGmDehM5xNcqLekfjDU5AcODmpnCIdVn+hph mK0JmaAw2gMs95XQ5KDWEA3jt2Ndsb7OCjUKIRqo/6tN9/KQWbRHlz+KobLnukKBS6Xm vx/hyd3mKhluhl5djZjYt4IiY7DCIGWygXbsVJ1OdZRy0W8m/1HvPhATbwKYKHttEqOz MzVHe+hapqo+kAMrtLezoNWy5vmxFdcedioBxjnY09dQrUirRS7CuHbYHdxDovn83u7Y rUhQaKWeP0GHimmd57mDOou1RD+SlMbYPnEVFNZWx1/SAH6rgXtxVH26MrZNydPVchyf /zFw== X-Gm-Message-State: AOAM532ukhKwqkv/dqza6LjSAcDkuzvdjmUPQfv6OpYefkqrKOTGVT3c ju6W3/Tl3LMkdnXc5Ne18Pihe+2RDa23yw== X-Google-Smtp-Source: ABdhPJxK4XXKnQGobCBqHh76POSC+z9Ke+p+LTz1D3JP2gHzRU/+u4NHtcl7CZeRa8gdrJN3jKtIxA== X-Received: by 2002:a05:6000:1043:: with SMTP id c3mr3984815wrx.140.1611918054595; Fri, 29 Jan 2021 03:00:54 -0800 (PST) From: Peter Maydell To: qemu-devel@nongnu.org Subject: [PULL 44/46] arm: Don't set freq properties on CMSDK timer, dualtimer, watchdog, ARMSSE Date: Fri, 29 Jan 2021 11:00:10 +0000 Message-Id: <20210129110012.8660-45-peter.maydell@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20210129110012.8660-1-peter.maydell@linaro.org> References: <20210129110012.8660-1-peter.maydell@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2a00:1450:4864:20::434; envelope-from=peter.maydell@linaro.org; helo=mail-wr1-x434.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.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @linaro.org) Remove all the code that sets frequency properties on the CMSDK timer, dualtimer and watchdog devices and on the ARMSSE SoC device: these properties are unused now that the devices rely on their Clock inputs instead. Signed-off-by: Peter Maydell Reviewed-by: Philippe Mathieu-Daud=C3=A9 Reviewed-by: Luc Michel Tested-by: Philippe Mathieu-Daud=C3=A9 Message-id: 20210128114145.20536-24-peter.maydell@linaro.org Message-id: 20210121190622.22000-24-peter.maydell@linaro.org --- hw/arm/armsse.c | 7 ------- hw/arm/mps2-tz.c | 1 - hw/arm/mps2.c | 3 --- hw/arm/musca.c | 1 - hw/arm/stellaris.c | 3 --- 5 files changed, 15 deletions(-) diff --git a/hw/arm/armsse.c b/hw/arm/armsse.c index 9a6b24c79aa..34855e667de 100644 --- a/hw/arm/armsse.c +++ b/hw/arm/armsse.c @@ -727,7 +727,6 @@ static void armsse_realize(DeviceState *dev, Error **er= rp) * it to the appropriate PPC port; then we can realize the PPC and * map its upstream ends to the right place in the container. */ - qdev_prop_set_uint32(DEVICE(&s->timer0), "pclk-frq", s->mainclk_frq); qdev_connect_clock_in(DEVICE(&s->timer0), "pclk", s->mainclk); if (!sysbus_realize(SYS_BUS_DEVICE(&s->timer0), errp)) { return; @@ -738,7 +737,6 @@ static void armsse_realize(DeviceState *dev, Error **er= rp) object_property_set_link(OBJECT(&s->apb_ppc0), "port[0]", OBJECT(mr), &error_abort); =20 - qdev_prop_set_uint32(DEVICE(&s->timer1), "pclk-frq", s->mainclk_frq); qdev_connect_clock_in(DEVICE(&s->timer1), "pclk", s->mainclk); if (!sysbus_realize(SYS_BUS_DEVICE(&s->timer1), errp)) { return; @@ -749,7 +747,6 @@ static void armsse_realize(DeviceState *dev, Error **er= rp) object_property_set_link(OBJECT(&s->apb_ppc0), "port[1]", OBJECT(mr), &error_abort); =20 - qdev_prop_set_uint32(DEVICE(&s->dualtimer), "pclk-frq", s->mainclk_frq= ); qdev_connect_clock_in(DEVICE(&s->dualtimer), "TIMCLK", s->mainclk); if (!sysbus_realize(SYS_BUS_DEVICE(&s->dualtimer), errp)) { return; @@ -908,7 +905,6 @@ static void armsse_realize(DeviceState *dev, Error **er= rp) /* Devices behind APB PPC1: * 0x4002f000: S32K timer */ - qdev_prop_set_uint32(DEVICE(&s->s32ktimer), "pclk-frq", S32KCLK); qdev_connect_clock_in(DEVICE(&s->s32ktimer), "pclk", s->s32kclk); if (!sysbus_realize(SYS_BUS_DEVICE(&s->s32ktimer), errp)) { return; @@ -1002,7 +998,6 @@ static void armsse_realize(DeviceState *dev, Error **e= rrp) qdev_connect_gpio_out(DEVICE(&s->nmi_orgate), 0, qdev_get_gpio_in_named(DEVICE(&s->armv7m), "NMI"= , 0)); =20 - qdev_prop_set_uint32(DEVICE(&s->s32kwatchdog), "wdogclk-frq", S32KCLK); qdev_connect_clock_in(DEVICE(&s->s32kwatchdog), "WDOGCLK", s->s32kclk); if (!sysbus_realize(SYS_BUS_DEVICE(&s->s32kwatchdog), errp)) { return; @@ -1013,7 +1008,6 @@ static void armsse_realize(DeviceState *dev, Error **= errp) =20 /* 0x40080000 .. 0x4008ffff : ARMSSE second Base peripheral region */ =20 - qdev_prop_set_uint32(DEVICE(&s->nswatchdog), "wdogclk-frq", s->mainclk= _frq); qdev_connect_clock_in(DEVICE(&s->nswatchdog), "WDOGCLK", s->mainclk); if (!sysbus_realize(SYS_BUS_DEVICE(&s->nswatchdog), errp)) { return; @@ -1022,7 +1016,6 @@ static void armsse_realize(DeviceState *dev, Error **= errp) armsse_get_common_irq_in(s, 1)); sysbus_mmio_map(SYS_BUS_DEVICE(&s->nswatchdog), 0, 0x40081000); =20 - qdev_prop_set_uint32(DEVICE(&s->swatchdog), "wdogclk-frq", s->mainclk_= frq); qdev_connect_clock_in(DEVICE(&s->swatchdog), "WDOGCLK", s->mainclk); if (!sysbus_realize(SYS_BUS_DEVICE(&s->swatchdog), errp)) { return; diff --git a/hw/arm/mps2-tz.c b/hw/arm/mps2-tz.c index 7acdf490f28..90caa914934 100644 --- a/hw/arm/mps2-tz.c +++ b/hw/arm/mps2-tz.c @@ -413,7 +413,6 @@ static void mps2tz_common_init(MachineState *machine) object_property_set_link(OBJECT(&mms->iotkit), "memory", OBJECT(system_memory), &error_abort); qdev_prop_set_uint32(iotkitdev, "EXP_NUMIRQ", MPS2TZ_NUMIRQ); - qdev_prop_set_uint32(iotkitdev, "MAINCLK_FRQ", SYSCLK_FRQ); qdev_connect_clock_in(iotkitdev, "MAINCLK", mms->sysclk); qdev_connect_clock_in(iotkitdev, "S32KCLK", mms->s32kclk); sysbus_realize(SYS_BUS_DEVICE(&mms->iotkit), &error_fatal); diff --git a/hw/arm/mps2.c b/hw/arm/mps2.c index cd1c215f941..39add416db5 100644 --- a/hw/arm/mps2.c +++ b/hw/arm/mps2.c @@ -346,7 +346,6 @@ static void mps2_common_init(MachineState *machine) object_initialize_child(OBJECT(mms), name, &mms->timer[i], TYPE_CMSDK_APB_TIMER); sbd =3D SYS_BUS_DEVICE(&mms->timer[i]); - qdev_prop_set_uint32(DEVICE(&mms->timer[i]), "pclk-frq", SYSCLK_FR= Q); qdev_connect_clock_in(DEVICE(&mms->timer[i]), "pclk", mms->sysclk); sysbus_realize_and_unref(sbd, &error_fatal); sysbus_mmio_map(sbd, 0, base); @@ -355,7 +354,6 @@ static void mps2_common_init(MachineState *machine) =20 object_initialize_child(OBJECT(mms), "dualtimer", &mms->dualtimer, TYPE_CMSDK_APB_DUALTIMER); - qdev_prop_set_uint32(DEVICE(&mms->dualtimer), "pclk-frq", SYSCLK_FRQ); qdev_connect_clock_in(DEVICE(&mms->dualtimer), "TIMCLK", mms->sysclk); sysbus_realize(SYS_BUS_DEVICE(&mms->dualtimer), &error_fatal); sysbus_connect_irq(SYS_BUS_DEVICE(&mms->dualtimer), 0, @@ -363,7 +361,6 @@ static void mps2_common_init(MachineState *machine) sysbus_mmio_map(SYS_BUS_DEVICE(&mms->dualtimer), 0, 0x40002000); object_initialize_child(OBJECT(mms), "watchdog", &mms->watchdog, TYPE_CMSDK_APB_WATCHDOG); - qdev_prop_set_uint32(DEVICE(&mms->watchdog), "wdogclk-frq", SYSCLK_FRQ= ); qdev_connect_clock_in(DEVICE(&mms->watchdog), "WDOGCLK", mms->sysclk); sysbus_realize(SYS_BUS_DEVICE(&mms->watchdog), &error_fatal); sysbus_connect_irq(SYS_BUS_DEVICE(&mms->watchdog), 0, diff --git a/hw/arm/musca.c b/hw/arm/musca.c index a9292482a06..945643c3cd7 100644 --- a/hw/arm/musca.c +++ b/hw/arm/musca.c @@ -385,7 +385,6 @@ static void musca_init(MachineState *machine) qdev_prop_set_uint32(ssedev, "EXP_NUMIRQ", mmc->num_irqs); qdev_prop_set_uint32(ssedev, "init-svtor", mmc->init_svtor); qdev_prop_set_uint32(ssedev, "SRAM_ADDR_WIDTH", mmc->sram_addr_width); - qdev_prop_set_uint32(ssedev, "MAINCLK_FRQ", SYSCLK_FRQ); qdev_connect_clock_in(ssedev, "MAINCLK", mms->sysclk); qdev_connect_clock_in(ssedev, "S32KCLK", mms->s32kclk); /* diff --git a/hw/arm/stellaris.c b/hw/arm/stellaris.c index 9b67c739ef2..5acb043a07e 100644 --- a/hw/arm/stellaris.c +++ b/hw/arm/stellaris.c @@ -1415,9 +1415,6 @@ static void stellaris_init(MachineState *ms, stellari= s_board_info *board) if (board->dc1 & (1 << 3)) { /* watchdog present */ dev =3D qdev_new(TYPE_LUMINARY_WATCHDOG); =20 - /* system_clock_scale is valid now */ - uint32_t mainclk =3D NANOSECONDS_PER_SECOND / system_clock_scale; - qdev_prop_set_uint32(dev, "wdogclk-frq", mainclk); qdev_connect_clock_in(dev, "WDOGCLK", qdev_get_clock_out(ssys_dev, "SYSCLK")); =20 --=20 2.20.1 From nobody Thu May 16 19:07:36 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1611920228; cv=none; d=zohomail.com; s=zohoarc; b=FqsocxG94P5O9zSGgv6sO0y2Pj6fxucxTOooXHIv6wptuMjJ/aJq4WFiPU0AD62iBc96vgvCtEVSj+Mql1SuhGPo2pHmQIvnzldgHuHp9kcyt15fJz5h3Hvdz66M0dPJHN7w9dh6BFbIgYif+EZgN4SMFEpEzWPGA53+4EFXd+w= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1611920228; h=Content-Type:Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=dmUaGgriEhx0mSkPdXXGRqxxRRW9jjlroxPjEYaS55o=; b=fAMxC/QT3rydP4hwmL7O+iAGsr4DeJJMwa71Ynlp7smo8vB+7gBlB8UsujbE72n8i7jRS0wB1ApenEBzjFMh2zCldJoOaqmMtivgNUF6c3fq06tDRROHp8wZHiObPyNZnCzTTq5YGO53ZQyPe6AwbG2xP1dRB9SedjM7LALyGFE= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1611920228228561.4321964947294; Fri, 29 Jan 2021 03:37:08 -0800 (PST) Received: from localhost ([::1]:37230 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1l5S5L-00036D-4n for importer@patchew.org; Fri, 29 Jan 2021 06:37:07 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:60164) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1l5RWT-0005CF-7o for qemu-devel@nongnu.org; Fri, 29 Jan 2021 06:01:05 -0500 Received: from mail-wm1-x32f.google.com ([2a00:1450:4864:20::32f]:53569) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1l5RWL-0007BQ-18 for qemu-devel@nongnu.org; Fri, 29 Jan 2021 06:01:04 -0500 Received: by mail-wm1-x32f.google.com with SMTP id j18so6496750wmi.3 for ; Fri, 29 Jan 2021 03:00:56 -0800 (PST) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [81.2.115.148]) by smtp.gmail.com with ESMTPSA id w20sm9268761wmm.12.2021.01.29.03.00.54 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 29 Jan 2021 03:00:54 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:subject:date:message-id:in-reply-to:references:mime-version :content-transfer-encoding; bh=dmUaGgriEhx0mSkPdXXGRqxxRRW9jjlroxPjEYaS55o=; b=RBPi+YW2dJW+AikqvR0kOH0e7QrqgOq0BcfScII4d2lgH35uJxyNs0Mr7J+Ihs7MPg awFj2VVvHGy8WCMQj0CjBClGi+LZMQYfhZmHj7mPOTxcrKiBgWYpEls+x7pJ5fQMXV3C 0HnIeyFqD760on8mr/4IO1q9SL9Xi6mpBzB3gb3hMCqy91EEP6d49SfdnOkCh6ZC9rkK +ApOK+HQMIqvvF5kRy6TSw+6TzKu25tS/wMtZFzQp4Ef1drnvWvQdkCXsTVxZKCVxahG KLQqK7oPTgl4l/lXZph+gTQsS1KhSnHgwKZfaRcnkU8a16mYpFHw/VImi9XQaMVU1por 22pQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=dmUaGgriEhx0mSkPdXXGRqxxRRW9jjlroxPjEYaS55o=; b=TzLueYGg1RACFkpcfxHe0cDe4YjymWN2Pa3LKjoBRuB5NVDYH/MWJ+9R/8CArQrN3O eYvLX7hFvojtyVL5UtD0uzDXeDg6GLyYCJROX1kOyBdgyGKgobnFdkCKfEzhqYWApwQM 7thevUI5Ff9Y6tUYzIzbUTkqwxx6jCMs/O5Sac6ScjUt6UF04dajhmPYgRy44UQodnOo g6qHuHaPSTKdvKQmfHkqXHhgjWWDs8CicOwR/E+7lMO5G81/NEKykjsSBzZHLPd2x49j JcTrskLd6X1rsaUPU/i98wINVqzSAXUx+md/Ol0Q3obL9PoL4UHMgZiMO+BBzybKAys0 rBIg== X-Gm-Message-State: AOAM531UN+amiMckHr/6NwusaCHm/9rUliYNoEj+0EXP9i32YNxOleeQ sHIFFpVx4RhvkZUVlhWxNf66k1hEMEx9uA== X-Google-Smtp-Source: ABdhPJz9Wn9m56It9BTwN3RGUbyptKtWqujgphamNBIYSphYaKaqYQaf0tdtkSOc/0iyRgauKIYXaA== X-Received: by 2002:a1c:730f:: with SMTP id d15mr3211377wmb.135.1611918055455; Fri, 29 Jan 2021 03:00:55 -0800 (PST) From: Peter Maydell To: qemu-devel@nongnu.org Subject: [PULL 45/46] arm: Remove frq properties on CMSDK timer, dualtimer, watchdog, ARMSSE Date: Fri, 29 Jan 2021 11:00:11 +0000 Message-Id: <20210129110012.8660-46-peter.maydell@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20210129110012.8660-1-peter.maydell@linaro.org> References: <20210129110012.8660-1-peter.maydell@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2a00:1450:4864:20::32f; envelope-from=peter.maydell@linaro.org; helo=mail-wm1-x32f.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.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @linaro.org) Now no users are setting the frq properties on the CMSDK timer, dualtimer, watchdog or ARMSSE SoC devices, we can remove the properties and the struct fields that back them. Signed-off-by: Peter Maydell Reviewed-by: Philippe Mathieu-Daud=C3=A9 Reviewed-by: Luc Michel Tested-by: Philippe Mathieu-Daud=C3=A9 Message-id: 20210128114145.20536-25-peter.maydell@linaro.org Message-id: 20210121190622.22000-25-peter.maydell@linaro.org --- include/hw/arm/armsse.h | 2 -- include/hw/timer/cmsdk-apb-dualtimer.h | 2 -- include/hw/timer/cmsdk-apb-timer.h | 2 -- include/hw/watchdog/cmsdk-apb-watchdog.h | 2 -- hw/arm/armsse.c | 2 -- hw/timer/cmsdk-apb-dualtimer.c | 6 ------ hw/timer/cmsdk-apb-timer.c | 6 ------ hw/watchdog/cmsdk-apb-watchdog.c | 6 ------ 8 files changed, 28 deletions(-) diff --git a/include/hw/arm/armsse.h b/include/hw/arm/armsse.h index bfa1e79c4fe..676cd4f36b0 100644 --- a/include/hw/arm/armsse.h +++ b/include/hw/arm/armsse.h @@ -41,7 +41,6 @@ * + Clock input "S32KCLK": slow 32KHz clock used for a few peripherals * + QOM property "memory" is a MemoryRegion containing the devices provi= ded * by the board model. - * + QOM property "MAINCLK_FRQ" is the frequency of the main system clock * + QOM property "EXP_NUMIRQ" sets the number of expansion interrupts. * (In hardware, the SSE-200 permits the number of expansion interrupts * for the two CPUs to be configured separately, but we restrict it to @@ -218,7 +217,6 @@ struct ARMSSE { /* Properties */ MemoryRegion *board_memory; uint32_t exp_numirq; - uint32_t mainclk_frq; uint32_t sram_addr_width; uint32_t init_svtor; bool cpu_fpu[SSE_MAX_CPUS]; diff --git a/include/hw/timer/cmsdk-apb-dualtimer.h b/include/hw/timer/cmsd= k-apb-dualtimer.h index 3adbb01dd34..f3ec86c00b5 100644 --- a/include/hw/timer/cmsdk-apb-dualtimer.h +++ b/include/hw/timer/cmsdk-apb-dualtimer.h @@ -16,7 +16,6 @@ * https://developer.arm.com/products/system-design/system-design-kits/cor= tex-m-system-design-kit * * QEMU interface: - * + QOM property "pclk-frq": frequency at which the timer is clocked * + Clock input "TIMCLK": clock (for both timers) * + sysbus MMIO region 0: the register bank * + sysbus IRQ 0: combined timer interrupt TIMINTC @@ -63,7 +62,6 @@ struct CMSDKAPBDualTimer { /*< public >*/ MemoryRegion iomem; qemu_irq timerintc; - uint32_t pclk_frq; Clock *timclk; =20 CMSDKAPBDualTimerModule timermod[CMSDK_APB_DUALTIMER_NUM_MODULES]; diff --git a/include/hw/timer/cmsdk-apb-timer.h b/include/hw/timer/cmsdk-ap= b-timer.h index 54f7ec8c502..c4c7eae8499 100644 --- a/include/hw/timer/cmsdk-apb-timer.h +++ b/include/hw/timer/cmsdk-apb-timer.h @@ -23,7 +23,6 @@ OBJECT_DECLARE_SIMPLE_TYPE(CMSDKAPBTimer, CMSDK_APB_TIMER) =20 /* * QEMU interface: - * + QOM property "pclk-frq": frequency at which the timer is clocked * + Clock input "pclk": clock for the timer * + sysbus MMIO region 0: the register bank * + sysbus IRQ 0: timer interrupt TIMERINT @@ -35,7 +34,6 @@ struct CMSDKAPBTimer { /*< public >*/ MemoryRegion iomem; qemu_irq timerint; - uint32_t pclk_frq; struct ptimer_state *timer; Clock *pclk; =20 diff --git a/include/hw/watchdog/cmsdk-apb-watchdog.h b/include/hw/watchdog= /cmsdk-apb-watchdog.h index 34069ca6969..c6b3e78731e 100644 --- a/include/hw/watchdog/cmsdk-apb-watchdog.h +++ b/include/hw/watchdog/cmsdk-apb-watchdog.h @@ -16,7 +16,6 @@ * https://developer.arm.com/products/system-design/system-design-kits/cor= tex-m-system-design-kit * * QEMU interface: - * + QOM property "wdogclk-frq": frequency at which the watchdog is clock= ed * + Clock input "WDOGCLK": clock for the watchdog's timer * + sysbus MMIO region 0: the register bank * + sysbus IRQ 0: watchdog interrupt @@ -53,7 +52,6 @@ struct CMSDKAPBWatchdog { /*< public >*/ MemoryRegion iomem; qemu_irq wdogint; - uint32_t wdogclk_frq; bool is_luminary; struct ptimer_state *timer; Clock *wdogclk; diff --git a/hw/arm/armsse.c b/hw/arm/armsse.c index 34855e667de..26e1a8c95b6 100644 --- a/hw/arm/armsse.c +++ b/hw/arm/armsse.c @@ -48,7 +48,6 @@ static Property iotkit_properties[] =3D { DEFINE_PROP_LINK("memory", ARMSSE, board_memory, TYPE_MEMORY_REGION, MemoryRegion *), DEFINE_PROP_UINT32("EXP_NUMIRQ", ARMSSE, exp_numirq, 64), - DEFINE_PROP_UINT32("MAINCLK_FRQ", ARMSSE, mainclk_frq, 0), DEFINE_PROP_UINT32("SRAM_ADDR_WIDTH", ARMSSE, sram_addr_width, 15), DEFINE_PROP_UINT32("init-svtor", ARMSSE, init_svtor, 0x10000000), DEFINE_PROP_BOOL("CPU0_FPU", ARMSSE, cpu_fpu[0], true), @@ -60,7 +59,6 @@ static Property armsse_properties[] =3D { DEFINE_PROP_LINK("memory", ARMSSE, board_memory, TYPE_MEMORY_REGION, MemoryRegion *), DEFINE_PROP_UINT32("EXP_NUMIRQ", ARMSSE, exp_numirq, 64), - DEFINE_PROP_UINT32("MAINCLK_FRQ", ARMSSE, mainclk_frq, 0), DEFINE_PROP_UINT32("SRAM_ADDR_WIDTH", ARMSSE, sram_addr_width, 15), DEFINE_PROP_UINT32("init-svtor", ARMSSE, init_svtor, 0x10000000), DEFINE_PROP_BOOL("CPU0_FPU", ARMSSE, cpu_fpu[0], false), diff --git a/hw/timer/cmsdk-apb-dualtimer.c b/hw/timer/cmsdk-apb-dualtimer.c index 828127b366f..ef49f5852d3 100644 --- a/hw/timer/cmsdk-apb-dualtimer.c +++ b/hw/timer/cmsdk-apb-dualtimer.c @@ -533,11 +533,6 @@ static const VMStateDescription cmsdk_apb_dualtimer_vm= state =3D { } }; =20 -static Property cmsdk_apb_dualtimer_properties[] =3D { - DEFINE_PROP_UINT32("pclk-frq", CMSDKAPBDualTimer, pclk_frq, 0), - DEFINE_PROP_END_OF_LIST(), -}; - static void cmsdk_apb_dualtimer_class_init(ObjectClass *klass, void *data) { DeviceClass *dc =3D DEVICE_CLASS(klass); @@ -545,7 +540,6 @@ static void cmsdk_apb_dualtimer_class_init(ObjectClass = *klass, void *data) dc->realize =3D cmsdk_apb_dualtimer_realize; dc->vmsd =3D &cmsdk_apb_dualtimer_vmstate; dc->reset =3D cmsdk_apb_dualtimer_reset; - device_class_set_props(dc, cmsdk_apb_dualtimer_properties); } =20 static const TypeInfo cmsdk_apb_dualtimer_info =3D { diff --git a/hw/timer/cmsdk-apb-timer.c b/hw/timer/cmsdk-apb-timer.c index f053146d88f..ee51ce3369c 100644 --- a/hw/timer/cmsdk-apb-timer.c +++ b/hw/timer/cmsdk-apb-timer.c @@ -261,11 +261,6 @@ static const VMStateDescription cmsdk_apb_timer_vmstat= e =3D { } }; =20 -static Property cmsdk_apb_timer_properties[] =3D { - DEFINE_PROP_UINT32("pclk-frq", CMSDKAPBTimer, pclk_frq, 0), - DEFINE_PROP_END_OF_LIST(), -}; - static void cmsdk_apb_timer_class_init(ObjectClass *klass, void *data) { DeviceClass *dc =3D DEVICE_CLASS(klass); @@ -273,7 +268,6 @@ static void cmsdk_apb_timer_class_init(ObjectClass *kla= ss, void *data) dc->realize =3D cmsdk_apb_timer_realize; dc->vmsd =3D &cmsdk_apb_timer_vmstate; dc->reset =3D cmsdk_apb_timer_reset; - device_class_set_props(dc, cmsdk_apb_timer_properties); } =20 static const TypeInfo cmsdk_apb_timer_info =3D { diff --git a/hw/watchdog/cmsdk-apb-watchdog.c b/hw/watchdog/cmsdk-apb-watch= dog.c index 9cad0c67da4..302f1711738 100644 --- a/hw/watchdog/cmsdk-apb-watchdog.c +++ b/hw/watchdog/cmsdk-apb-watchdog.c @@ -373,11 +373,6 @@ static const VMStateDescription cmsdk_apb_watchdog_vms= tate =3D { } }; =20 -static Property cmsdk_apb_watchdog_properties[] =3D { - DEFINE_PROP_UINT32("wdogclk-frq", CMSDKAPBWatchdog, wdogclk_frq, 0), - DEFINE_PROP_END_OF_LIST(), -}; - static void cmsdk_apb_watchdog_class_init(ObjectClass *klass, void *data) { DeviceClass *dc =3D DEVICE_CLASS(klass); @@ -385,7 +380,6 @@ static void cmsdk_apb_watchdog_class_init(ObjectClass *= klass, void *data) dc->realize =3D cmsdk_apb_watchdog_realize; dc->vmsd =3D &cmsdk_apb_watchdog_vmstate; dc->reset =3D cmsdk_apb_watchdog_reset; - device_class_set_props(dc, cmsdk_apb_watchdog_properties); } =20 static const TypeInfo cmsdk_apb_watchdog_info =3D { --=20 2.20.1 From nobody Thu May 16 19:07:36 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1611920121; cv=none; d=zohomail.com; s=zohoarc; b=B8qmTVMJQD67kZE0ebok0ysOtwxj8NrgNQwvwDnFWZUtXS3FdH0YAEwQgy80/v82eZXab7c5CdQ9ZXE+ML+LdV+O7dgodPiDwlJf0O26xtrzG/Sk+W+Dz7/euJIMgzl86gusTmRyr1QSWvVHQ9N0JDHmYF9xy8gD2Avj3Dmr1wg= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1611920121; h=Content-Type:Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=ZoznrQk5rWNMNVC35EjX7ZEcNiC7xyz+q93KkX/Abcg=; b=nHKYAODrdZHOhWCaOI3koI5h9fZDkSt5ttdHosG5rRvC+IyljHky7yDOC/X5ZkqZK7zr1Symq+bP+ws7HJ5XXcYIUT8DJqgMM3ijBooo+lJSi78mn/eP4+8kHsNLs1rGMbjkyCz/JC0q/5MoHoujTXu58dLOmvNmhCvxF0cYFR0= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1611920121292210.27125372043554; Fri, 29 Jan 2021 03:35:21 -0800 (PST) Received: from localhost ([::1]:58948 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1l5S3b-0000N7-CF for importer@patchew.org; Fri, 29 Jan 2021 06:35:19 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:60154) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1l5RWR-0005Bm-Pe for qemu-devel@nongnu.org; Fri, 29 Jan 2021 06:01:03 -0500 Received: from mail-wr1-x432.google.com ([2a00:1450:4864:20::432]:34989) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1l5RWL-0007Ba-Jf for qemu-devel@nongnu.org; Fri, 29 Jan 2021 06:01:03 -0500 Received: by mail-wr1-x432.google.com with SMTP id l12so8406851wry.2 for ; Fri, 29 Jan 2021 03:00:57 -0800 (PST) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [81.2.115.148]) by smtp.gmail.com with ESMTPSA id w20sm9268761wmm.12.2021.01.29.03.00.55 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 29 Jan 2021 03:00:55 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:subject:date:message-id:in-reply-to:references:mime-version :content-transfer-encoding; bh=ZoznrQk5rWNMNVC35EjX7ZEcNiC7xyz+q93KkX/Abcg=; b=Sggzt45AuDaAW9REnwrfat1tSzN7jlNwL2U89Qn3h085ghiRtCOqjNFNOZn0+XbJDF cZJSJQ/msJ+Ky+AQ0kY8QjNXn6AlSWvQ/kHyBMJy3R/H2mG/CfryJYgZ2qNucd44EHFx ZlWkmOOKaG0VD0FImYC2VheLlEnkW47POpK0x9SL3QNA7CwpFqeAWsC1BXN3iJ925Jwq XLV7boKKfqOaZMjpID2px18TXO+YAMPebpUXLldma3VwyFCLKYhR2Tadxv8jKdjWVXeJ ZJrMSO7AMKU/6EZPOoTpwxWbvrlAjUdApDTiEqIeUctV6kFVRSvcD86pT4GDp7Qo9RPg K0TA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=ZoznrQk5rWNMNVC35EjX7ZEcNiC7xyz+q93KkX/Abcg=; b=IhvA/Pe2MuBMtNXEShSq27MvstgwrGKYEwI86WRV8cYDPwlM3QU8zSSfPf7qqm1eZN 7I4ymgUO2ruKDOX9OO1DCea2pGb8HHnP5IXJsmX23NvxNIjaFig73ZSBs0W7C1xMCd6J jxAG9VBdVLPW9qGW7Wzu5ENDnX0tNapC4yNc6m26HKHSEePU84hl3O9/VRbsdqkPkDDv y38lWEoljN2at/iQSCDW/lCh9tqNhkyPdMPy+XajyvYBuQ/F9yDBJtRrIZtuDnmc6M1r uW/EA+okN7lWl/1To8Nx4faajjHeqGbnMPtzJpsFHWzguoh4qKHX6MOo9bajjTea7nOH 151g== X-Gm-Message-State: AOAM532Bfrhf/78v3VREoYXXWroOxRm7d1sF4bWUokbFbvxQeUFg3Tge iXLl8cZqvU18gNX2nZ9yoJMAAF0BGV8a5A== X-Google-Smtp-Source: ABdhPJygicnIb47yvZc1+RHpExp4VoGlmqPk6BwqxAzowOhjcBHa4k0cohps09v45C8oYE3K7+HtkQ== X-Received: by 2002:a5d:524a:: with SMTP id k10mr3909390wrc.394.1611918056287; Fri, 29 Jan 2021 03:00:56 -0800 (PST) From: Peter Maydell To: qemu-devel@nongnu.org Subject: [PULL 46/46] hw/arm/stellaris: Remove board-creation reset of STELLARIS_SYS Date: Fri, 29 Jan 2021 11:00:12 +0000 Message-Id: <20210129110012.8660-47-peter.maydell@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20210129110012.8660-1-peter.maydell@linaro.org> References: <20210129110012.8660-1-peter.maydell@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2a00:1450:4864:20::432; envelope-from=peter.maydell@linaro.org; helo=mail-wr1-x432.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.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @linaro.org) Now that the watchdog device uses its Clock input rather than being passed the value of system_clock_scale at creation time, we can remove the hack where we reset the STELLARIS_SYS at board creation time to force it to set system_clock_scale. Instead it will be reset at the usual point in startup and will inform the watchdog of the clock frequency at that point. Signed-off-by: Peter Maydell Reviewed-by: Luc Michel Tested-by: Philippe Mathieu-Daud=C3=A9 Reviewed-by: Philippe Mathieu-Daud=C3=A9 Message-id: 20210128114145.20536-26-peter.maydell@linaro.org Message-id: 20210121190622.22000-26-peter.maydell@linaro.org Reviewed-by: Philippe Mathieu-Daud=C3=A9 --- hw/arm/stellaris.c | 10 ---------- 1 file changed, 10 deletions(-) diff --git a/hw/arm/stellaris.c b/hw/arm/stellaris.c index 5acb043a07e..ad72c0959f1 100644 --- a/hw/arm/stellaris.c +++ b/hw/arm/stellaris.c @@ -780,16 +780,6 @@ static DeviceState *stellaris_sys_init(uint32_t base, = qemu_irq irq, sysbus_mmio_map(sbd, 0, base); sysbus_connect_irq(sbd, 0, irq); =20 - /* - * Normally we should not be resetting devices like this during - * board creation. For the moment we need to do so, because - * system_clock_scale will only get set when the STELLARIS_SYS - * device is reset, and we need its initial value to pass to - * the watchdog device. This hack can be removed once the - * watchdog has been converted to use a Clock input instead. - */ - device_cold_reset(dev); - return dev; } =20 --=20 2.20.1