From patchwork Thu Nov 2 17:38:03 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 740445 Delivered-To: patch@linaro.org Received: by 2002:a5d:538f:0:b0:32d:baff:b0ca with SMTP id d15csp961366wrv; Thu, 2 Nov 2023 10:39:30 -0700 (PDT) X-Google-Smtp-Source: AGHT+IEEZEfktg6rQ1YM/squWa2n3DswtGVxNaiFXsdtRvkLUNIcKA9M2j54mwcAa8bzVyuQGyW9 X-Received: by 2002:a05:620a:6017:b0:76e:ffaa:a816 with SMTP id dw23-20020a05620a601700b0076effaaa816mr20264281qkb.75.1698946770674; Thu, 02 Nov 2023 10:39:30 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1698946770; cv=none; d=google.com; s=arc-20160816; b=0FrA6ZQo4w+4vprHXJqj1Dh7tennv+cLwv2GfYRoJ+JqTrxx5KHjXYcVOdgB9DxRO4 oSlnTxv2GZiLXrPyijvDStMy/+pHpWDOJ0z0FWjm6dfnf5RGBdL4pmBzsj29jkhcK6Pl tglx9cHE4oQ7H7QtSXs6EKSOyGUtuiZ53NTz+c+qdlTxFOU4JvfK76ZVO6bQYZdMXlxx Y+bv8pw1AlCiOoA2vgGRS6s9ah9pWHbPQ9p903OcBd9aHkB0m5LRkouJ/vmy5Yx4DVSl LQrQ6kQYSIkMfHC5cxbHIiBq5mKb7dJFNxThYAWgmuLaMybTMFDin1n9Kk1fkymAIu+G PNIQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:to:from :dkim-signature; bh=I+vgPU4tOb8/bVT99xfNgupP4cOnz/a8+RCUWUXb08Y=; fh=PnYt+qEB9tAfMKoqBm2xjKOFpYyFFGPudh5cVIoieJM=; b=k/AlY9r+HXHetHyzfRh9YYLBTGyYPG0QUyGS0+qkynb4DrqBYIdkM4mEEf0eYl2kgr 2M66dmVKEVIATvD6VMNUoWpPKNZpqkFCyXB63qVoBRNiT4eXKpTFbDwOGymTVAmer4ea 6Fptrvs/SrmYbtgE28ugB06cd+LKkVrqH4JFA0lpTLPZ5bwupbMYk/KPcvzimca/12z3 TO0aHFzQEbYWUthwCsBZRuRzzrY6oNBTm+R7Hks4PHWeoytbKXm3pz91z+8pSwBt4PEv pWui93ZKN099hSbs5R4gLnQOimtW293X6pW+/CM6/26sEYslQoo30lH50bKibQvgAuKw 5v6g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=xsBUYtZ2; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id y15-20020a05620a0e0f00b00778b173f525si242984qkm.397.2023.11.02.10.39.30 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Thu, 02 Nov 2023 10:39:30 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=xsBUYtZ2; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qybec-0003CM-P2; Thu, 02 Nov 2023 13:38:50 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qybeV-00038R-Rv for qemu-devel@nongnu.org; Thu, 02 Nov 2023 13:38:46 -0400 Received: from mail-lj1-x22d.google.com ([2a00:1450:4864:20::22d]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qybeS-0002h7-KY for qemu-devel@nongnu.org; Thu, 02 Nov 2023 13:38:43 -0400 Received: by mail-lj1-x22d.google.com with SMTP id 38308e7fff4ca-2c515527310so17091641fa.2 for ; Thu, 02 Nov 2023 10:38:39 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1698946718; x=1699551518; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:from:to:cc:subject:date:message-id :reply-to; bh=I+vgPU4tOb8/bVT99xfNgupP4cOnz/a8+RCUWUXb08Y=; b=xsBUYtZ21QW2ODBNY2Anm9jX/PH+ONwkIppCMNI/ksUKJvG7CfKf+eo433CCrQGgPH pdbr5Z3rMDamxtSJufR62euZtgehM1E+IVx4kOUKL2v1l0TJwnF63cw2FooiptxJj2LQ pOZ43QugL5PkHT+HKI8AbRoR6Uo56vkaZwmIB6HxZFDxJeUwCNmW+RJm28pT+1qIvwF0 jRdFxikuuAEf45HA9TvNvqdkw2IWX5bPFRisOXHZiH85HHW6C3OqvctYiWjq/BRfRQCx IeIL3oG3iDYy2uPVhbH4+SdlYNRzuYiep7LNpYVBOsuXmhZ7/m/oDDrgEnw4NMwUl7Zm KsdQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1698946718; x=1699551518; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=I+vgPU4tOb8/bVT99xfNgupP4cOnz/a8+RCUWUXb08Y=; b=WNoHuDFO3Zgi/VCA8/a2MaRL+WY1i94/A1AOZIcdL6sqpCNXM6mf80MQ5BoLmQkmcw EPSEuZLEoHewoDqfOMaRRWekFF7qSG4TL0dh27h0oWC92hWEGAFE0gafzs/mBuDd12Fn TDzNLBdqitEn3xcDCxvrJ8CD2pBU+dKupn1PvzIzmaehWgUH867vj/ylvWMiPUt8te/j Zmup/lDTG6uvpOP83pGcWFXYKcnUNIHkaB22S8JCCltCxxhk9ZcMcAC/G9tNHDDoUHr4 5uVTDsB/Mam50UJyFvZ0JliiQYBiqYiqSirNUfl7MkP+otzYGceDsXamHP28WI1ZVt/y mWEg== X-Gm-Message-State: AOJu0Yx5TItuauKVNuLbriBV7JwpQsvwG2O9mxCvqwTm0/ByXPE9Qa6c tC0cf0y5W8Ag4LGw6ec26UAMVfL1eBWtTu1lVXM= X-Received: by 2002:a2e:9410:0:b0:2c4:fe14:a85 with SMTP id i16-20020a2e9410000000b002c4fe140a85mr17240272ljh.18.1698946717764; Thu, 02 Nov 2023 10:38:37 -0700 (PDT) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [2001:8b0:1d0::2]) by smtp.gmail.com with ESMTPSA id e16-20020adff350000000b003258934a4bcsm3046805wrp.42.2023.11.02.10.38.36 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 02 Nov 2023 10:38:36 -0700 (PDT) From: Peter Maydell To: qemu-devel@nongnu.org Subject: [PULL 01/33] linux-user/elfload: Add missing arm64 hwcap values Date: Thu, 2 Nov 2023 17:38:03 +0000 Message-Id: <20231102173835.609985-2-peter.maydell@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231102173835.609985-1-peter.maydell@linaro.org> References: <20231102173835.609985-1-peter.maydell@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::22d; envelope-from=peter.maydell@linaro.org; helo=mail-lj1-x22d.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, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org From: Marielle Novastrider Specifically DIT, LSE2, and MTE3. We already expose detection of these via the CPUID interface, but missed these from ELF hwcaps. Signed-off-by: Marielle Novastrider Reviewed-by: Philippe Mathieu-Daudé Message-id: 20231029210058.38986-1-marielle@novastrider.com Reviewed-by: Peter Maydell [PMM: fixed conflict with feature tests moving to cpu-features.h] Signed-off-by: Peter Maydell --- target/arm/cpu-features.h | 5 +++++ linux-user/elfload.c | 3 +++ 2 files changed, 8 insertions(+) diff --git a/target/arm/cpu-features.h b/target/arm/cpu-features.h index 66212cd7ecc..954d3582685 100644 --- a/target/arm/cpu-features.h +++ b/target/arm/cpu-features.h @@ -669,6 +669,11 @@ static inline bool isar_feature_aa64_mte(const ARMISARegisters *id) return FIELD_EX64(id->id_aa64pfr1, ID_AA64PFR1, MTE) >= 2; } +static inline bool isar_feature_aa64_mte3(const ARMISARegisters *id) +{ + return FIELD_EX64(id->id_aa64pfr1, ID_AA64PFR1, MTE) >= 3; +} + static inline bool isar_feature_aa64_sme(const ARMISARegisters *id) { return FIELD_EX64(id->id_aa64pfr1, ID_AA64PFR1, SME) != 0; diff --git a/linux-user/elfload.c b/linux-user/elfload.c index 8761f9e26b8..3f3975352af 100644 --- a/linux-user/elfload.c +++ b/linux-user/elfload.c @@ -800,12 +800,14 @@ uint32_t get_elf_hwcap(void) GET_FEATURE_ID(aa64_sm4, ARM_HWCAP_A64_SM4); GET_FEATURE_ID(aa64_fp16, ARM_HWCAP_A64_FPHP | ARM_HWCAP_A64_ASIMDHP); GET_FEATURE_ID(aa64_atomics, ARM_HWCAP_A64_ATOMICS); + GET_FEATURE_ID(aa64_lse2, ARM_HWCAP_A64_USCAT); GET_FEATURE_ID(aa64_rdm, ARM_HWCAP_A64_ASIMDRDM); GET_FEATURE_ID(aa64_dp, ARM_HWCAP_A64_ASIMDDP); GET_FEATURE_ID(aa64_fcma, ARM_HWCAP_A64_FCMA); GET_FEATURE_ID(aa64_sve, ARM_HWCAP_A64_SVE); GET_FEATURE_ID(aa64_pauth, ARM_HWCAP_A64_PACA | ARM_HWCAP_A64_PACG); GET_FEATURE_ID(aa64_fhm, ARM_HWCAP_A64_ASIMDFHM); + GET_FEATURE_ID(aa64_dit, ARM_HWCAP_A64_DIT); GET_FEATURE_ID(aa64_jscvt, ARM_HWCAP_A64_JSCVT); GET_FEATURE_ID(aa64_sb, ARM_HWCAP_A64_SB); GET_FEATURE_ID(aa64_condm_4, ARM_HWCAP_A64_FLAGM); @@ -839,6 +841,7 @@ uint32_t get_elf_hwcap2(void) GET_FEATURE_ID(aa64_rndr, ARM_HWCAP2_A64_RNG); GET_FEATURE_ID(aa64_bti, ARM_HWCAP2_A64_BTI); GET_FEATURE_ID(aa64_mte, ARM_HWCAP2_A64_MTE); + GET_FEATURE_ID(aa64_mte3, ARM_HWCAP2_A64_MTE3); GET_FEATURE_ID(aa64_sme, (ARM_HWCAP2_A64_SME | ARM_HWCAP2_A64_SME_F32F32 | ARM_HWCAP2_A64_SME_B16F32 | From patchwork Thu Nov 2 17:38:04 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 740477 Delivered-To: patch@linaro.org Received: by 2002:a5d:538f:0:b0:32d:baff:b0ca with SMTP id d15csp964417wrv; Thu, 2 Nov 2023 10:46:52 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHTQU7Amv/i2TO5JHmShob+VNvOoI2iojPbi22tHeZOcWBwQ/px+Z5E0SH/6nsgRxhDZylE X-Received: by 2002:a5d:4390:0:b0:314:1313:c3d6 with SMTP id i16-20020a5d4390000000b003141313c3d6mr13760482wrq.33.1698947211866; Thu, 02 Nov 2023 10:46:51 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1698947211; cv=none; d=google.com; s=arc-20160816; b=GniDfPeQ5AHQ0QehMsbyscJGsQ8kSUsGTg2xHF5HgLKi9Ng9/+tj/cJe7YJ70Ed1D/ EB+s+A+WOGSNJs+Bc7HblMyuaZlNHmATqP1ILwlU3VM/o5UWu8laNRW7I2irUKxpqiLs j3VaKHy+m4xf9kgFLhpxzyi5n4nOaRmNRCK+ASZmCxU24tdlPXVroejg/xlVYMBlQsoX 2qNRp1zE4K6YYNK9WpMvvVi+QyCW8FQE625mxHC0VQrQTU0ZPM3H/fKdgaeXK1hQQpYi jInw3XNG989zt5+TtbEcvV8rCnjy6oUI6eIJRCk8YJ7o5Jvjeriv6SNL4yQjg+LzWUIk /KWg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:to:from :dkim-signature; bh=sgDJG5akxTAKePXGw4lqiUSqBtfv2oC7eu7relbo21k=; fh=PnYt+qEB9tAfMKoqBm2xjKOFpYyFFGPudh5cVIoieJM=; b=wTZzGxVprzgqZ6JJeTfMceTkgkCwSmnLpO/SwsuH5QIexT3X4UaNmMJoYjW0LADFKz +/qy7ZqJf6f0Ko2mhuNF4m5H8Y5FXomMW8dop6fNzas8qllltp4flWyoQBWHTI76zA7o AsZ2ouEeiih8AgiITxw6prXVrfUG5zi8K2C03SQgnWoVK20mMDbS3GTA2Fo6uaNB9n5i Ve0sWhPhf7Fv/UoKVra96OUcQgP1qv0J3Lf60aru1H2jjMod0Ugts/MUIMrC9DMNYm7U ggfAOADdK3gUPnfFa+CAr5E060cN6y5/cmcKq/m//nTdXKtZw2pvoGf+wN90gjeG5/ID fr7w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=jtCdb26N; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id b16-20020adfe650000000b0032d893b8decsi1939535wrn.349.2023.11.02.10.46.51 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Thu, 02 Nov 2023 10:46:51 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=jtCdb26N; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qybfO-0003oT-Jk; Thu, 02 Nov 2023 13:39:38 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qybeh-0003Go-FE for qemu-devel@nongnu.org; Thu, 02 Nov 2023 13:38:55 -0400 Received: from mail-lf1-x133.google.com ([2a00:1450:4864:20::133]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qybeS-0002hD-La for qemu-devel@nongnu.org; Thu, 02 Nov 2023 13:38:55 -0400 Received: by mail-lf1-x133.google.com with SMTP id 2adb3069b0e04-5094727fa67so1489934e87.3 for ; Thu, 02 Nov 2023 10:38:40 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1698946718; x=1699551518; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:from:to:cc:subject:date:message-id :reply-to; bh=sgDJG5akxTAKePXGw4lqiUSqBtfv2oC7eu7relbo21k=; b=jtCdb26NTFuiGeyHLsl7Dg/73PJ1MzK/qJsVQzd/Sn99frgjU/iWWAmgLTfLxMZ7yv 9blL8YfUrQTxNnfKsWME1txpWwp/0LTa32dbfMtuwf0m8VJLuOuXnQjg52lsatltnm4A AtcaBx4unMsMmQ7SmkxFPv60xXCOTaUA3pmgEY0j6kd9Ypd0/eWtvqZuEtR7w0zG8z+t q6mdmwZD29SmL5E0O5bzzHCEt/uSqMjMQlrIO6EgACfNaZO0+/IHYGExpA7pKza1v8XS kqQmvqKyP7CKkEMRg+kAzc/V7a6ydoMbT+JlVhKi1w6k08wpLwKB+WAtxMT2luaUuhGA Pn7g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1698946718; x=1699551518; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=sgDJG5akxTAKePXGw4lqiUSqBtfv2oC7eu7relbo21k=; b=NeAuZt2mZ33tigwDZ3TZMvNKp52XIuSleK5ENzuK66oeIDh5H/lTmGTJgiB8Inpili mTrkpsbRt59kd6a/MLmRAFnEssOxc7tpuDUaiJGh+AuHT6r94c/tj17KO/b3EMBVu44n OlRdtJcK875uBHgKFz9n70XCEAjhrWMjYTN2k+948vJaWQfCkApVyJOQXb92nEE2xDTo 1O428dUHoO/P/ijC64hz9XJylQemIwcRaD2YgKuBN8/9JZ+cSqLupS3UboHRF1F7FSnZ htTdbBvEHd3iiQSq0ku6qDDjezdEw5rOHels5AXPaSsHoG8koM9MtADKm8Su9dT1O0Pb NM2A== X-Gm-Message-State: AOJu0YzOCc0ztQczIIFiWXUl42s11Znhw3c8TgJt80aE3H3Kwo5WIXnI YJrKZffKgZmwCwYDPpZc5FYrrGIbxwNRmi6dtjE= X-Received: by 2002:ac2:5e86:0:b0:507:9702:c11d with SMTP id b6-20020ac25e86000000b005079702c11dmr13281349lfq.64.1698946718357; Thu, 02 Nov 2023 10:38:38 -0700 (PDT) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [2001:8b0:1d0::2]) by smtp.gmail.com with ESMTPSA id e16-20020adff350000000b003258934a4bcsm3046805wrp.42.2023.11.02.10.38.37 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 02 Nov 2023 10:38:37 -0700 (PDT) From: Peter Maydell To: qemu-devel@nongnu.org Subject: [PULL 02/33] hw/input/stellaris_input: Rename to stellaris_gamepad Date: Thu, 2 Nov 2023 17:38:04 +0000 Message-Id: <20231102173835.609985-3-peter.maydell@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231102173835.609985-1-peter.maydell@linaro.org> References: <20231102173835.609985-1-peter.maydell@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::133; envelope-from=peter.maydell@linaro.org; helo=mail-lf1-x133.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, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org This source file implements a stellaris gamepad device; rename it so that it is a closer match to the device name. Signed-off-by: Peter Maydell Reviewed-by: Philippe Mathieu-Daudé Tested-by: Philippe Mathieu-Daudé Message-id: 20231030114802.3671871-2-peter.maydell@linaro.org --- include/hw/input/{gamepad.h => stellaris_gamepad.h} | 6 +++--- hw/arm/stellaris.c | 2 +- hw/input/{stellaris_input.c => stellaris_gamepad.c} | 2 +- hw/arm/Kconfig | 2 +- hw/input/Kconfig | 2 +- hw/input/meson.build | 2 +- 6 files changed, 8 insertions(+), 8 deletions(-) rename include/hw/input/{gamepad.h => stellaris_gamepad.h} (77%) rename hw/input/{stellaris_input.c => stellaris_gamepad.c} (98%) diff --git a/include/hw/input/gamepad.h b/include/hw/input/stellaris_gamepad.h similarity index 77% rename from include/hw/input/gamepad.h rename to include/hw/input/stellaris_gamepad.h index 6f6aa2406aa..23cfd3c95f3 100644 --- a/include/hw/input/gamepad.h +++ b/include/hw/input/stellaris_gamepad.h @@ -8,11 +8,11 @@ * See the COPYING file in the top-level directory. */ -#ifndef HW_INPUT_GAMEPAD_H -#define HW_INPUT_GAMEPAD_H +#ifndef HW_INPUT_STELLARIS_GAMEPAD_H +#define HW_INPUT_STELLARIS_GAMEPAD_H -/* stellaris_input.c */ +/* stellaris_gamepad.c */ void stellaris_gamepad_init(int n, qemu_irq *irq, const int *keycode); #endif diff --git a/hw/arm/stellaris.c b/hw/arm/stellaris.c index aa5b0ddfaa5..96585dd7106 100644 --- a/hw/arm/stellaris.c +++ b/hw/arm/stellaris.c @@ -23,7 +23,7 @@ #include "sysemu/sysemu.h" #include "hw/arm/armv7m.h" #include "hw/char/pl011.h" -#include "hw/input/gamepad.h" +#include "hw/input/stellaris_gamepad.h" #include "hw/irq.h" #include "hw/watchdog/cmsdk-apb-watchdog.h" #include "migration/vmstate.h" diff --git a/hw/input/stellaris_input.c b/hw/input/stellaris_gamepad.c similarity index 98% rename from hw/input/stellaris_input.c rename to hw/input/stellaris_gamepad.c index e6ee5e11f1b..3bab557cab3 100644 --- a/hw/input/stellaris_input.c +++ b/hw/input/stellaris_gamepad.c @@ -8,7 +8,7 @@ */ #include "qemu/osdep.h" -#include "hw/input/gamepad.h" +#include "hw/input/stellaris_gamepad.h" #include "hw/irq.h" #include "migration/vmstate.h" #include "ui/console.h" diff --git a/hw/arm/Kconfig b/hw/arm/Kconfig index 7e683484405..841f3131ea5 100644 --- a/hw/arm/Kconfig +++ b/hw/arm/Kconfig @@ -291,7 +291,7 @@ config STELLARIS select SSD0303 # OLED display select SSD0323 # OLED display select SSI_SD - select STELLARIS_INPUT + select STELLARIS_GAMEPAD select STELLARIS_ENET # ethernet select STELLARIS_GPTM # general purpose timer module select UNIMP diff --git a/hw/input/Kconfig b/hw/input/Kconfig index 55865bb3869..f86e98c8293 100644 --- a/hw/input/Kconfig +++ b/hw/input/Kconfig @@ -20,7 +20,7 @@ config PL050 config PS2 bool -config STELLARIS_INPUT +config STELLARIS_GAMEPAD bool config TSC2005 diff --git a/hw/input/meson.build b/hw/input/meson.build index c0d44821800..640556bbbcc 100644 --- a/hw/input/meson.build +++ b/hw/input/meson.build @@ -5,7 +5,7 @@ system_ss.add(when: 'CONFIG_LM832X', if_true: files('lm832x.c')) system_ss.add(when: 'CONFIG_PCKBD', if_true: files('pckbd.c')) system_ss.add(when: 'CONFIG_PL050', if_true: files('pl050.c')) system_ss.add(when: 'CONFIG_PS2', if_true: files('ps2.c')) -system_ss.add(when: 'CONFIG_STELLARIS_INPUT', if_true: files('stellaris_input.c')) +system_ss.add(when: 'CONFIG_STELLARIS_GAMEPAD', if_true: files('stellaris_gamepad.c')) system_ss.add(when: 'CONFIG_TSC2005', if_true: files('tsc2005.c')) system_ss.add(when: 'CONFIG_VIRTIO_INPUT', if_true: files('virtio-input.c')) From patchwork Thu Nov 2 17:38:05 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 740471 Delivered-To: patch@linaro.org Received: by 2002:a5d:538f:0:b0:32d:baff:b0ca with SMTP id d15csp962677wrv; Thu, 2 Nov 2023 10:42:40 -0700 (PDT) X-Google-Smtp-Source: AGHT+IENzHdGpanFaHemEP7qfU4O3rD855wMCzicXlAb/lAm0A0l490GYIIoOT29C4s2Ey5JG+Jr X-Received: by 2002:a05:600c:3594:b0:406:177e:5de8 with SMTP id p20-20020a05600c359400b00406177e5de8mr16597035wmq.35.1698946960757; Thu, 02 Nov 2023 10:42:40 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1698946960; cv=none; d=google.com; s=arc-20160816; b=p78DqBr+O/fH1TDHR6zdYjZStRsFNhzNkWsmO34O2x8bcQxqaviT02M7D3Fpeix0B9 xxxfx0h4AyNJ27bGGLLq1FkWQLOLRJlcvyhgYm8/gz65/Ry0H0xx2HvWv1tmK+Blna1w yneXvR1aLyVMy4sPDBuzWNCQQo1MHL6xEgk8etQSvm1NuefOOgjbwcwGcTgV55DoEpFR +JDwYBugh1fEhBTnqBLn3IQDLc5WFeUN1sTOVPKYBMo6udnIKqPzxGRi+8vgWotmiYFq eoKjvJT51SdjPbJl5AkJiZgT0s8iOfPv9gDk9X1dnyNqVRSCx/t2iUax07VnFbV9OU7G lTcQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:to:from :dkim-signature; bh=lDR8Uzh/MINtLhDHndq6EFbiMHNldQPogkDbsU2X7bw=; fh=PnYt+qEB9tAfMKoqBm2xjKOFpYyFFGPudh5cVIoieJM=; b=O5LXQVgQUkZ5rtP5QpD7rfSgqPiqzqpOVVRdCfscIksUnGP5MMVWqEICOcqojXoxRk SK3ELtMPIJKgzLXkhVQs1FeM3XPmopLJ02TGGXRN/lXVW5cXQ/910xHa7VgrDfDwS9T7 XvJ7kMkAlz7tCCmuo4AzZ8RhKT6ZfpFyhzASUq6ijZV03BSZtPY24YhlYMLVCb+9zHa6 0eaUAlXhjWrb/Z+0mPlF190+sYJALCm+1n47NJo+ou04mQLB8nurHBJoxdfZ0IzfOF0O PvQhzV/60PWineA2YWyns2LZRwZno6WAudUHHI8jxJe7A3eO4KQfpu1yOfzhsFfKn54z NTvw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=t8+w+4Bt; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id e11-20020a5d6d0b000000b0032f7c3f76a1si1956856wrq.245.2023.11.02.10.42.40 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Thu, 02 Nov 2023 10:42:40 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=t8+w+4Bt; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qybes-0003ND-Eq; Thu, 02 Nov 2023 13:39:06 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qybec-0003Cw-2K for qemu-devel@nongnu.org; Thu, 02 Nov 2023 13:38:50 -0400 Received: from mail-lj1-x233.google.com ([2a00:1450:4864:20::233]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qybeS-0002hG-ME for qemu-devel@nongnu.org; Thu, 02 Nov 2023 13:38:48 -0400 Received: by mail-lj1-x233.google.com with SMTP id 38308e7fff4ca-2c6ef6c1ec2so14478001fa.2 for ; Thu, 02 Nov 2023 10:38:40 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1698946719; x=1699551519; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:from:to:cc:subject:date:message-id :reply-to; bh=lDR8Uzh/MINtLhDHndq6EFbiMHNldQPogkDbsU2X7bw=; b=t8+w+4BtC660xs+Cc23jTbVzFWMqmKNMA4Q2CWsJbS+u7/Zx485C753mvwnM1Igv4R Nj5fNlV1bgsdtpaQ9ChTMEK9UwJqGNBEIQ7yRizL2X7JF3e+xZ6aDEWA+HGyVuK2i8+b Dl418FHtsdPbD7foJdva6kk/tOGXg2m/u39/P6xESQ74X8FXYNcNfScxY8TVSWSRej/Z pnpCveDgi0mGWh5JbLCieW4QDVTEdxXlUuTID7pe3w4JAKKTEh8bblJdr2eNC6qu7LGw Ikjjr9l7mHwlzRgQ6PkTePh4OrPL6h0c5PaJBwR3ESg1zGAkhRARwL+xC2+pqxXNL1mq 0JcA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1698946719; x=1699551519; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=lDR8Uzh/MINtLhDHndq6EFbiMHNldQPogkDbsU2X7bw=; b=Y43Jk3YrruvSLInsJ9aNd3e/0Xo+DL/U+3Uvb70HFL2AJjbWoyPdBCa2aUVg2X59O9 okEWy9rPhbXmzLWV5PgERpAiM/h3E1kES9j0iAG/KDRNZr460eFfLY6ZuTBaUhkenPOi SMCFBuTlbSFvjSMY3LEa+2VJxapFzL2YBrCq8g/ZwowMmJ5PBuBDkRTm4KFNMqk3tkEG 4dE33hg2WgdeMMEvEgZyvwx6Ke6jvrS23qTI1V4GyViXxdCYfbmQOiOE0Bl4FYcXlmUR OaspbRXp8Hs+DMYWTwIMyWwcoK46LLbKl0lCvLsQxHTI7WJEZNRYZdYYrmXKeitPogui kGKg== X-Gm-Message-State: AOJu0YyCWiZElBY/nFYh0QP/UmLWw5YoqezyZDi4p4w+l3hbUrRE6bQz /6OhBw0WM3uNszdfZmvu5hfWPIZo0Y6ndFx06dU= X-Received: by 2002:a2e:991a:0:b0:2c5:9e2:ed14 with SMTP id v26-20020a2e991a000000b002c509e2ed14mr15360921lji.39.1698946718846; Thu, 02 Nov 2023 10:38:38 -0700 (PDT) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [2001:8b0:1d0::2]) by smtp.gmail.com with ESMTPSA id e16-20020adff350000000b003258934a4bcsm3046805wrp.42.2023.11.02.10.38.38 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 02 Nov 2023 10:38:38 -0700 (PDT) From: Peter Maydell To: qemu-devel@nongnu.org Subject: [PULL 03/33] hw/input/stellaris_gamepad: Rename structs to our usual convention Date: Thu, 2 Nov 2023 17:38:05 +0000 Message-Id: <20231102173835.609985-4-peter.maydell@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231102173835.609985-1-peter.maydell@linaro.org> References: <20231102173835.609985-1-peter.maydell@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::233; envelope-from=peter.maydell@linaro.org; helo=mail-lj1-x233.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, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org Rename the structs in stellaris_gamepad.c to our now-standard CamelCase convention. Signed-off-by: Peter Maydell Reviewed-by: Philippe Mathieu-Daudé Tested-by: Philippe Mathieu-Daudé Message-id: 20231030114802.3671871-3-peter.maydell@linaro.org --- hw/input/stellaris_gamepad.c | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/hw/input/stellaris_gamepad.c b/hw/input/stellaris_gamepad.c index 3bab557cab3..377101a4035 100644 --- a/hw/input/stellaris_gamepad.c +++ b/hw/input/stellaris_gamepad.c @@ -17,17 +17,17 @@ typedef struct { qemu_irq irq; int keycode; uint8_t pressed; -} gamepad_button; +} StellarisGamepadButton; typedef struct { - gamepad_button *buttons; + StellarisGamepadButton *buttons; int num_buttons; int extension; -} gamepad_state; +} StellarisGamepad; static void stellaris_gamepad_put_key(void * opaque, int keycode) { - gamepad_state *s = (gamepad_state *)opaque; + StellarisGamepad *s = (StellarisGamepad *)opaque; int i; int down; @@ -55,7 +55,7 @@ static const VMStateDescription vmstate_stellaris_button = { .version_id = 0, .minimum_version_id = 0, .fields = (VMStateField[]) { - VMSTATE_UINT8(pressed, gamepad_button), + VMSTATE_UINT8(pressed, StellarisGamepadButton), VMSTATE_END_OF_LIST() } }; @@ -65,11 +65,11 @@ static const VMStateDescription vmstate_stellaris_gamepad = { .version_id = 2, .minimum_version_id = 2, .fields = (VMStateField[]) { - VMSTATE_INT32(extension, gamepad_state), - VMSTATE_STRUCT_VARRAY_POINTER_INT32(buttons, gamepad_state, + VMSTATE_INT32(extension, StellarisGamepad), + VMSTATE_STRUCT_VARRAY_POINTER_INT32(buttons, StellarisGamepad, num_buttons, vmstate_stellaris_button, - gamepad_button), + StellarisGamepadButton), VMSTATE_END_OF_LIST() } }; @@ -77,11 +77,11 @@ static const VMStateDescription vmstate_stellaris_gamepad = { /* Returns an array of 5 output slots. */ void stellaris_gamepad_init(int n, qemu_irq *irq, const int *keycode) { - gamepad_state *s; + StellarisGamepad *s; int i; - s = g_new0(gamepad_state, 1); - s->buttons = g_new0(gamepad_button, n); + s = g_new0(StellarisGamepad, 1); + s->buttons = g_new0(StellarisGamepadButton, n); for (i = 0; i < n; i++) { s->buttons[i].irq = irq[i]; s->buttons[i].keycode = keycode[i]; From patchwork Thu Nov 2 17:38:06 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 740463 Delivered-To: patch@linaro.org Received: by 2002:a5d:538f:0:b0:32d:baff:b0ca with SMTP id d15csp962264wrv; Thu, 2 Nov 2023 10:41:38 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHVWW+lBD3/flajP8nEEZetJrcJlvSrphb7t7fmuRSKKoxrsOoDO3LyLvOC3s/sWk2oW0Kc X-Received: by 2002:a05:600c:4ecf:b0:3fe:2bb1:11ba with SMTP id g15-20020a05600c4ecf00b003fe2bb111bamr18284723wmq.27.1698946898737; Thu, 02 Nov 2023 10:41:38 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1698946898; cv=none; d=google.com; s=arc-20160816; b=g5aSTtigMAjNdaddc3c+YIsWtM4GeL7tFs4MNC7UwBZQklfJhzVaGjV1MyzWpMwzyD 6pWhVRPoW/G18MQKSBewieLdyWwLsx4OQVvJvdGdZ6cIGkVsNx9QLNFh0kRjo9OxPjnV lkAtWfP9MsiDdX/z+jASobCyXKnyPpadcieiUYrC15Sskk9+/uMKHCniO48dX43F9L+J /dXCoQov8+rE/XQzUcIYAdbFF6hSNDvzF7jXchGD1VJlbq8lcTvnPAkU3m5qVgk07vwS uCAH6V/C4RHrbhoPOD9g/3nqT1nhQH0R4w/wWDHvLUKejX+eT9wX9dKzVdG+UWrDQsEP e0qQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:to:from :dkim-signature; bh=gMrisEf6ekgxSDT/iAPpxMfjnEW+8vsNxHXZQ7hNGP8=; fh=PnYt+qEB9tAfMKoqBm2xjKOFpYyFFGPudh5cVIoieJM=; b=axlxGWxsaVfbROQWM4OJ5nL3nNUEkVunIqpEDq2KY4HdkPqfCpm49ulUJxjGJLG9HC T0gUCw10LbimP3c2PAxXtza4i91w0hwURvihrVgj24MDsfTGghRQbiO3Fl55fB79hW3Y dbd1uoW4LVCBF5GWIAeQBMWuIMM5cf73L8Zpamhf8V+h/hZlQTFm3cA15EASL/u98Owj Y3ru7PCNHjdQwFIPYEXVtR+ZVm4MFIY4xmtqFcaVRjgZFVl8j5/++32hQ+GM055UnhxB QAREI0U7E0NgRXDQcSnOofhusC6+8O1H32FjzNiO8wIWRSckO9VNA1o9dIBtK4md6tvI aeig== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=FvhpbQd+; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id j4-20020adfff84000000b0032da0d27931si1907133wrr.989.2023.11.02.10.41.38 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Thu, 02 Nov 2023 10:41:38 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=FvhpbQd+; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qybgX-0005aw-Uy; Thu, 02 Nov 2023 13:40:55 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qybef-0003FO-KL for qemu-devel@nongnu.org; Thu, 02 Nov 2023 13:38:53 -0400 Received: from mail-wm1-x32a.google.com ([2a00:1450:4864:20::32a]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qybeS-0002hN-PO for qemu-devel@nongnu.org; Thu, 02 Nov 2023 13:38:53 -0400 Received: by mail-wm1-x32a.google.com with SMTP id 5b1f17b1804b1-40859dee28cso9068675e9.0 for ; Thu, 02 Nov 2023 10:38:40 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1698946719; x=1699551519; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:from:to:cc:subject:date:message-id :reply-to; bh=gMrisEf6ekgxSDT/iAPpxMfjnEW+8vsNxHXZQ7hNGP8=; b=FvhpbQd+xTs/1BjpS6ze/FLivmJHfU3+m2mr5RT9QsaD/oJMgoP1HBwumbepLlXP5N a9/xZJXaq4gs+3L12xmjgBlZ3zg4o09eGTpifzsjUW4Nb8/SmEPi/LU0Tv8og2H0Ajm2 AEntCwtS3QggEprKBuzxwfWzc93R50+91ZjZvWq4znsk9z8N8z+wMVvSwOB0hgjqr3U/ sTNHzzgQQPR14s7ujasi+rInPjWpgkAY7OpejjWUAY0ZI01+Gso2dGEd3CTp36YbRiTB ovTGTFK1q0YAw6aCLqElbZ9NET0BGo6MfE0zM042D4HB4MyKYEGcOKCJ0QDM+WfDQJ2x BXqg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1698946719; x=1699551519; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=gMrisEf6ekgxSDT/iAPpxMfjnEW+8vsNxHXZQ7hNGP8=; b=bAcRPRfbGWpwhl9iq2UNSrm1QeBMzdILXUYREMFQ0GJ249+5Qkrd5cxt7FwNlx3gme sDqkI/af6rXwIyBXNXv7co5Nqt6JlAEVT0jlCwg4nWxsIL0dgJt4Fpr8XUF72SztKl2d LrSaJTgUvCEi0D7RjUGxnsUcqkynXboSFI68LVmps4dqBftQf6lsBsLQONk+nlWoPrMp SmT8t6sMfC74VHi+anL55l+/FOxe9ezkSRjyXOYItBulTOv6PfXgD4ZBjMYD2S6vh+2Z /AXZi2A1p1ATw5amErdSZgXAgYFB+gWjAwecAERSI/2nUmzcs01SdmsyPTV+DfxaKtDd TaPg== X-Gm-Message-State: AOJu0YzVrud1V4PZSAKdrKEqvEQP1O90ermAMimjTujRKXM5E6XLBFaT eG4liJ/Lh6ZeDo1LBFyl6lVOzgMF+fxJReaGS8Y= X-Received: by 2002:a05:600c:1c9a:b0:401:d803:6243 with SMTP id k26-20020a05600c1c9a00b00401d8036243mr15990361wms.32.1698946719347; Thu, 02 Nov 2023 10:38:39 -0700 (PDT) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [2001:8b0:1d0::2]) by smtp.gmail.com with ESMTPSA id e16-20020adff350000000b003258934a4bcsm3046805wrp.42.2023.11.02.10.38.38 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 02 Nov 2023 10:38:39 -0700 (PDT) From: Peter Maydell To: qemu-devel@nongnu.org Subject: [PULL 04/33] qdev: Add qdev_prop_set_array() Date: Thu, 2 Nov 2023 17:38:06 +0000 Message-Id: <20231102173835.609985-5-peter.maydell@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231102173835.609985-1-peter.maydell@linaro.org> References: <20231102173835.609985-1-peter.maydell@linaro.org> MIME-Version: 1.0 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, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org From: Kevin Wolf Instead of exposing the ugly hack of how we represent arrays in qdev (a static "foo-len" property and after it is set, dynamically created "foo[i]" properties) to boards, add an interface that allows setting the whole array at once. Once all internal users of devices with array properties have been converted to use this function, we can change the implementation to move away from this hack. Signed-off-by: Kevin Wolf Reviewed-by: Peter Maydell Reviewed-by: Philippe Mathieu-Daudé Signed-off-by: Peter Maydell Tested-by: Philippe Mathieu-Daudé Message-id: 20231030114802.3671871-4-peter.maydell@linaro.org --- include/hw/qdev-properties.h | 3 +++ hw/core/qdev-properties.c | 21 +++++++++++++++++++++ 2 files changed, 24 insertions(+) diff --git a/include/hw/qdev-properties.h b/include/hw/qdev-properties.h index e1df08876c6..7fa2fdb7c94 100644 --- a/include/hw/qdev-properties.h +++ b/include/hw/qdev-properties.h @@ -206,6 +206,9 @@ void qdev_prop_set_macaddr(DeviceState *dev, const char *name, const uint8_t *value); void qdev_prop_set_enum(DeviceState *dev, const char *name, int value); +/* Takes ownership of @values */ +void qdev_prop_set_array(DeviceState *dev, const char *name, QList *values); + void *object_field_prop_ptr(Object *obj, Property *prop); void qdev_prop_register_global(GlobalProperty *prop); diff --git a/hw/core/qdev-properties.c b/hw/core/qdev-properties.c index 357b8761b54..950ef48e013 100644 --- a/hw/core/qdev-properties.c +++ b/hw/core/qdev-properties.c @@ -3,12 +3,14 @@ #include "qapi/error.h" #include "qapi/qapi-types-misc.h" #include "qapi/qmp/qerror.h" +#include "qapi/qmp/qlist.h" #include "qemu/ctype.h" #include "qemu/error-report.h" #include "qapi/visitor.h" #include "qemu/units.h" #include "qemu/cutils.h" #include "qdev-prop-internal.h" +#include "qom/qom-qobject.h" void qdev_prop_set_after_realize(DeviceState *dev, const char *name, Error **errp) @@ -739,6 +741,25 @@ void qdev_prop_set_enum(DeviceState *dev, const char *name, int value) &error_abort); } +void qdev_prop_set_array(DeviceState *dev, const char *name, QList *values) +{ + const QListEntry *entry; + g_autofree char *prop_len = g_strdup_printf("len-%s", name); + uint32_t i = 0; + + object_property_set_int(OBJECT(dev), prop_len, qlist_size(values), + &error_abort); + + QLIST_FOREACH_ENTRY(values, entry) { + g_autofree char *prop_idx = g_strdup_printf("%s[%u]", name, i); + object_property_set_qobject(OBJECT(dev), prop_idx, entry->value, + &error_abort); + i++; + } + + qobject_unref(values); +} + static GPtrArray *global_props(void) { static GPtrArray *gp; From patchwork Thu Nov 2 17:38:07 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 740459 Delivered-To: patch@linaro.org Received: by 2002:a5d:538f:0:b0:32d:baff:b0ca with SMTP id d15csp962126wrv; Thu, 2 Nov 2023 10:41:19 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHacPOQ2YDsE2YXlSe5ANYe2RS+5Whib7ckICqagPmlW5k0PNx/OWQjsomMFp2DWje2wWAr X-Received: by 2002:a25:ec11:0:b0:d9c:7d48:300b with SMTP id j17-20020a25ec11000000b00d9c7d48300bmr15289760ybh.33.1698946879186; Thu, 02 Nov 2023 10:41:19 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1698946879; cv=none; d=google.com; s=arc-20160816; b=VfrgAOuuDlyc7gU9nlgnChgPWwjgeO2vOJlz2CzWLqt8C49SNFJGz8UoqN8Rai5pdD XPXonstUMDdu1YNNDPJyROgSkXJShMLxcZBlgRItLVndBlRX5wzAH2I97ria0OhIqHFx OZzKgJKcYUp01tuFFPvmB6GMXfLgs0taJegmaOmRt9ZtX8zO3Nm3Ki1iF3n1cD7kuFdt PiCl+2DBRueZFOA2LXsGUXWedJhSf2MKc4GVPOy52EqqURZrUAF7wvcIcsnKC0132Vla 60FT8wjftBb2ygo7mv9coUFKlZ7clGmTrg3aViaLATPK69WhVgZ4z8ny475Tqu5X3J3h nnIA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:to:from :dkim-signature; bh=jPz9LWV8Rv5DH5etsrmvwliiqNBVJ3b6lP8HyjQY+Zo=; fh=PnYt+qEB9tAfMKoqBm2xjKOFpYyFFGPudh5cVIoieJM=; b=bDfwdgc0C9qY0riNOe9sRnRHxAkF2M5pAydj8rjpgPdxyU7vw4uDZ7GlFm4odvaGUp XXCnVv6qOtmL6W3b4WuZedZ1pYpZxJPAk5vFZKqpj1nDjGetQHPYzaC1hJMQ+oof60qZ Dhg1fJbEetRIgCo0Wxe1C9a/kz7IGRV6KWL+OM8qgH54H8jOktVeWHhWA1eze9Kx+MMk YN+KPJA/9z2euBvObAATjtFo9N49rNFtQiwuWydR6Lf2j8Zw9GyDOGT3cmZt7INcqsd0 owm22h1jFV+uoBEaYIZjKaIMLYSeVWXXxfrOyMkEstpLCZ4mafrbWrY3XRgvxmm8ZCVm cfQw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="SR/3o9D3"; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id p11-20020a05622a048b00b00417fa5bd43dsi280742qtx.314.2023.11.02.10.41.19 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Thu, 02 Nov 2023 10:41:19 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="SR/3o9D3"; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qybeq-0003N1-DQ; Thu, 02 Nov 2023 13:39:04 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qybeZ-0003B3-2O for qemu-devel@nongnu.org; Thu, 02 Nov 2023 13:38:47 -0400 Received: from mail-lj1-x231.google.com ([2a00:1450:4864:20::231]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qybeT-0002hU-PA for qemu-devel@nongnu.org; Thu, 02 Nov 2023 13:38:45 -0400 Received: by mail-lj1-x231.google.com with SMTP id 38308e7fff4ca-2c50ec238aeso17436551fa.0 for ; Thu, 02 Nov 2023 10:38:41 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1698946720; x=1699551520; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:from:to:cc:subject:date:message-id :reply-to; bh=jPz9LWV8Rv5DH5etsrmvwliiqNBVJ3b6lP8HyjQY+Zo=; b=SR/3o9D3dN+r2E3/K19LL6tAZpX2LvUiYulRd0BvZBojC+B8RALojJE9LEuKBPEFFn 0EvPXEAOFsqp7lAL+iH5c8vkB5xjZEGFv3iRK3wL/8Mj1PLzl0pQ6MjhIuVpKCM6eXS0 9Hvjhqsjj6rFvhguf3jAQJcx/TYLg5P4MR6LINKta41KVXHLk46wldal/GbxqBocWIVj iwHkxv7heOHtm5Cty2z0H+r3Qz3vemylkD4xgkDE7JoO4oSbLwcudy07FpAIdonKGcEJ s4AVJ9KGFGQu7plaGBHSx/jJB7OgHFMPuseCQY4r+raUg2TukC9Y1/x0Q2Dx7jKRXxtB tiAA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1698946720; x=1699551520; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=jPz9LWV8Rv5DH5etsrmvwliiqNBVJ3b6lP8HyjQY+Zo=; b=o6hgaVqtxLtdLa6mc6s7JFVQbyHSSU1GddfS/KNskyIxwRJEdBqjTQgTJkb+C18pB7 gZz7e61zoQdVHNzBoQdiCrvo1SfTnRklpk4ep+TBQNJSFSQ/T+PncmhAf+Ce9Q3K5Vfu ZLrJ9CgYy1Yqthv/SEAugsncimdgd4oZrTPg7RsxY2ZSZbnN61mF39tOzQE5k0Bfjsf0 lUu1m8483SksTo1glEL/b6rAAIBTCbPrxyK8qZS2La3swZRyhiaGeWgbrBXEYv91SGIs yrVuFDpgs/jOUIfrj7hD01HIGousHyaQ1n7oS2sldq0IJqr/A6WwLNTMSH9L1ol9Q5mL DLPQ== X-Gm-Message-State: AOJu0YwKFuFPDT0sh1Uh79Wx0uSv+ZvPUnAqahjSWMm+BQTN3SHcYbmD 8QcFgBLy0zz30dJdUCALQjQr+WwcSVOrYrudI4Q= X-Received: by 2002:a05:651c:70f:b0:2c5:a50b:2f08 with SMTP id z15-20020a05651c070f00b002c5a50b2f08mr12172213ljb.36.1698946719783; Thu, 02 Nov 2023 10:38:39 -0700 (PDT) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [2001:8b0:1d0::2]) by smtp.gmail.com with ESMTPSA id e16-20020adff350000000b003258934a4bcsm3046805wrp.42.2023.11.02.10.38.39 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 02 Nov 2023 10:38:39 -0700 (PDT) From: Peter Maydell To: qemu-devel@nongnu.org Subject: [PULL 05/33] hw/input/stellaris_gamepad: Remove StellarisGamepadButton struct Date: Thu, 2 Nov 2023 17:38:07 +0000 Message-Id: <20231102173835.609985-6-peter.maydell@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231102173835.609985-1-peter.maydell@linaro.org> References: <20231102173835.609985-1-peter.maydell@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::231; envelope-from=peter.maydell@linaro.org; helo=mail-lj1-x231.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, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org Currently for each button on the device we have a StellarisGamepadButton struct which has the irq, keycode and pressed state for it. When we convert to qdev, the qdev property and GPIO APIs are going to require that we have separate arrays for the irqs and keycodes. Convert from array-of-structs to three separate arrays in preparation. This is a migration compatibility break for the stellaris boards (lm3s6965evb, lm3s811evb). Signed-off-by: Peter Maydell Reviewed-by: Philippe Mathieu-Daudé Tested-by: Philippe Mathieu-Daudé Message-id: 20231030114802.3671871-5-peter.maydell@linaro.org --- v1=>v2: mention migration compat break in commit message; bump version fields in vmstate --- hw/input/stellaris_gamepad.c | 47 ++++++++++++------------------------ 1 file changed, 16 insertions(+), 31 deletions(-) diff --git a/hw/input/stellaris_gamepad.c b/hw/input/stellaris_gamepad.c index 377101a4035..82ddc47a26d 100644 --- a/hw/input/stellaris_gamepad.c +++ b/hw/input/stellaris_gamepad.c @@ -14,15 +14,11 @@ #include "ui/console.h" typedef struct { - qemu_irq irq; - int keycode; - uint8_t pressed; -} StellarisGamepadButton; - -typedef struct { - StellarisGamepadButton *buttons; - int num_buttons; + uint32_t num_buttons; int extension; + qemu_irq *irqs; + uint32_t *keycodes; + uint8_t *pressed; } StellarisGamepad; static void stellaris_gamepad_put_key(void * opaque, int keycode) @@ -40,36 +36,23 @@ static void stellaris_gamepad_put_key(void * opaque, int keycode) keycode = (keycode & 0x7f) | s->extension; for (i = 0; i < s->num_buttons; i++) { - if (s->buttons[i].keycode == keycode - && s->buttons[i].pressed != down) { - s->buttons[i].pressed = down; - qemu_set_irq(s->buttons[i].irq, down); + if (s->keycodes[i] == keycode && s->pressed[i] != down) { + s->pressed[i] = down; + qemu_set_irq(s->irqs[i], down); } } s->extension = 0; } -static const VMStateDescription vmstate_stellaris_button = { - .name = "stellaris_button", - .version_id = 0, - .minimum_version_id = 0, - .fields = (VMStateField[]) { - VMSTATE_UINT8(pressed, StellarisGamepadButton), - VMSTATE_END_OF_LIST() - } -}; - static const VMStateDescription vmstate_stellaris_gamepad = { .name = "stellaris_gamepad", - .version_id = 2, - .minimum_version_id = 2, + .version_id = 3, + .minimum_version_id = 3, .fields = (VMStateField[]) { VMSTATE_INT32(extension, StellarisGamepad), - VMSTATE_STRUCT_VARRAY_POINTER_INT32(buttons, StellarisGamepad, - num_buttons, - vmstate_stellaris_button, - StellarisGamepadButton), + VMSTATE_VARRAY_UINT32(pressed, StellarisGamepad, num_buttons, + 0, vmstate_info_uint8, uint8_t), VMSTATE_END_OF_LIST() } }; @@ -81,10 +64,12 @@ void stellaris_gamepad_init(int n, qemu_irq *irq, const int *keycode) int i; s = g_new0(StellarisGamepad, 1); - s->buttons = g_new0(StellarisGamepadButton, n); + s->irqs = g_new0(qemu_irq, n); + s->keycodes = g_new0(uint32_t, n); + s->pressed = g_new0(uint8_t, n); for (i = 0; i < n; i++) { - s->buttons[i].irq = irq[i]; - s->buttons[i].keycode = keycode[i]; + s->irqs[i] = irq[i]; + s->keycodes[i] = keycode[i]; } s->num_buttons = n; qemu_add_kbd_event_handler(stellaris_gamepad_put_key, s); From patchwork Thu Nov 2 17:38:08 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 740473 Delivered-To: patch@linaro.org Received: by 2002:a5d:538f:0:b0:32d:baff:b0ca with SMTP id d15csp962857wrv; Thu, 2 Nov 2023 10:43:11 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGqQfjYRBKQWbiOobE59DyiqKGLCbIbo0mPs5RoaV7IYwQSdSTl/b1j1z7APNRQACM5WyGg X-Received: by 2002:a05:600c:474f:b0:405:359a:c965 with SMTP id w15-20020a05600c474f00b00405359ac965mr16226481wmo.4.1698946991135; Thu, 02 Nov 2023 10:43:11 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1698946990; cv=none; d=google.com; s=arc-20160816; b=WdGTaVr68MiQFlmpzlUHliWgxXYDivSm/sBGd/KVeH1E6KtonQVnVEcDWHo9IGgnk6 Nj9LfxOkeuHiKKUwPyALJ7hwLf0S7SfppZ/utYacLkaC9Le+rpTm9fKaR10GZY0Boa2H FovDZbtc64xSkroPbvkfeDKFn937kV6SakCCnXgLwqOJ10Du6FHbaFwElB7W6WVrFW1l 9YHbgeXKe3ka+HAyruVQq6k+uVIGQ1W6n6Dj7/Zqju0FL89huqPdQywZD9c/Fk573/Ak FHtuWzqxo8qood+GYMR7k4qkLEVeZpL8knLsXiT+CQaSRwUySbrmmiK1srg4ABP7oGIb PykQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:to:from :dkim-signature; bh=ENWD1nZp2Yt56lOHCUjHLm86bI1I3Z4QSgJquKSlUGc=; fh=PnYt+qEB9tAfMKoqBm2xjKOFpYyFFGPudh5cVIoieJM=; b=MQbxbIF9Jw3EojjhU6kadt08wtThRZ/L7zoGXdS/A2/GVzmWxLkqIvdSMyu5RzQQNV nXBvWRvXMjGjBgE6JPy4o2YrF0FDFikZa+FGiyI+rZYg4akFOV0Kf71GdAFLTkoF/7WG a2BYyq3Y0UzlSUkRfM4UoFqwJhnCEHjn8SyN/cLBIK4lSPCbSANGqXrmKZP1fDL3keAi bGF+Bm4IB2xGtJpQWJmjoRbJjWDUomQH+h+gBqFBwOsf1xYKpoo3M/jXCGPwyhd39/yL Cz2CWB+fTJyCSwPR+PMZ9l15JGRCB58K/f9OW2+E92nrKJC2RKjnjjv29eTpgYZ5PXXz Y5yQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=TlzQYP+s; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id n18-20020a05600c3b9200b0040594b5a647si1918779wms.127.2023.11.02.10.43.10 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Thu, 02 Nov 2023 10:43:10 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=TlzQYP+s; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qyben-0003Hp-UD; Thu, 02 Nov 2023 13:39:02 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qybeZ-0003B1-1x for qemu-devel@nongnu.org; Thu, 02 Nov 2023 13:38:47 -0400 Received: from mail-wr1-x432.google.com ([2a00:1450:4864:20::432]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qybeT-0002hc-Lo for qemu-devel@nongnu.org; Thu, 02 Nov 2023 13:38:45 -0400 Received: by mail-wr1-x432.google.com with SMTP id ffacd0b85a97d-32ddfb38c02so735307f8f.3 for ; Thu, 02 Nov 2023 10:38:41 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1698946720; x=1699551520; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:from:to:cc:subject:date:message-id :reply-to; bh=ENWD1nZp2Yt56lOHCUjHLm86bI1I3Z4QSgJquKSlUGc=; b=TlzQYP+sTlGWHc4AU4NUWqo2Cqv/xhg57P10P7cM0NO8fO8aHX7rs6+qplFXZpynlb VLugeX/8hKhtM6VPbU7a1KTc2GDfrdL4IyxXZIYBHmLJ8MVpG5Hgmke6/tTpkILEc800 43a5QU5vTzfJykQgr5wqARu38ryWG3vy2w9aFghk3Ij8sBru2WetjJ8aF6OQEpNsWcV6 LH0zi2nyeePgcIqjbsxou3aQMstGI9vderW/g6rrBNh8GAenvWtylstG/RgMRJSY/W7q TXRPWVlzw0e68v0sIIlTjJvOy+UlFQ3euT1AE1tehlQwlbBmLnqHOGeY86op7c7/yAKP Pd2g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1698946720; x=1699551520; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=ENWD1nZp2Yt56lOHCUjHLm86bI1I3Z4QSgJquKSlUGc=; b=F3fwPvAbP5R45GN8ypJVXwPMc/KTZdyOixSYBU3nsad36WXQzovbb8TaJQ24TkATqB N0C32i4E59CZ4C1Mvl//PzNzJeqrQhZBFpxtPkZq/xmNPOsE6PraXpn0omTLZVKlITTR pi1YZfMvJaqz3lK+FRgHXTwkspEA/FOVOZCK+lr/aEp/x5hQ04oMAyJugmWVxwi8cxI9 9INbAWhndSC8jQtu0Cy69Vv5DmowJ1dlZAhurP4SmC6BHKy+6cArMqIUp8ARyeQVlAmy Ddxu7EtfDI8Q4bq55IcZY213Uiplv15qoysL6FdjvaUNro2zrwLs69Kmdq7y/cond2RF /GNA== X-Gm-Message-State: AOJu0YyqVwoENJ93/umkhtCAU+cWULagGVd4l/Oc13hox0chY65OthPW 8nP0iTDpj7IemFeZgAMJzqOURoHo7OoBbcoTeqY= X-Received: by 2002:a5d:47ab:0:b0:32f:8254:c97c with SMTP id 11-20020a5d47ab000000b0032f8254c97cmr13841062wrb.36.1698946720240; Thu, 02 Nov 2023 10:38:40 -0700 (PDT) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [2001:8b0:1d0::2]) by smtp.gmail.com with ESMTPSA id e16-20020adff350000000b003258934a4bcsm3046805wrp.42.2023.11.02.10.38.39 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 02 Nov 2023 10:38:40 -0700 (PDT) From: Peter Maydell To: qemu-devel@nongnu.org Subject: [PULL 06/33] hw/input/stellaris_input: Convert to qdev Date: Thu, 2 Nov 2023 17:38:08 +0000 Message-Id: <20231102173835.609985-7-peter.maydell@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231102173835.609985-1-peter.maydell@linaro.org> References: <20231102173835.609985-1-peter.maydell@linaro.org> MIME-Version: 1.0 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, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org Convert the hw/input/stellaris_input device to qdev. The interface uses an array property for the board to specify the keycodes to use, so the s->keycodes memory is now allocated by the array-property machinery. Signed-off-by: Peter Maydell Reviewed-by: Philippe Mathieu-Daudé Tested-by: Philippe Mathieu-Daudé Message-id: 20231030114802.3671871-6-peter.maydell@linaro.org --- include/hw/input/stellaris_gamepad.h | 23 ++++++++- hw/arm/stellaris.c | 26 ++++++++--- hw/input/stellaris_gamepad.c | 70 +++++++++++++++++++--------- 3 files changed, 87 insertions(+), 32 deletions(-) diff --git a/include/hw/input/stellaris_gamepad.h b/include/hw/input/stellaris_gamepad.h index 23cfd3c95f3..d6a6aecb06d 100644 --- a/include/hw/input/stellaris_gamepad.h +++ b/include/hw/input/stellaris_gamepad.h @@ -11,8 +11,27 @@ #ifndef HW_INPUT_STELLARIS_GAMEPAD_H #define HW_INPUT_STELLARIS_GAMEPAD_H +#include "hw/sysbus.h" +#include "qom/object.h" -/* stellaris_gamepad.c */ -void stellaris_gamepad_init(int n, qemu_irq *irq, const int *keycode); +/* + * QEMU interface: + * + QOM array property "keycodes": uint32_t QEMU keycodes to handle + * + unnamed GPIO outputs: one per keycode, in the same order as the + * "keycodes" array property entries; asserted when key is down + */ + +#define TYPE_STELLARIS_GAMEPAD "stellaris-gamepad" +OBJECT_DECLARE_SIMPLE_TYPE(StellarisGamepad, STELLARIS_GAMEPAD) + +struct StellarisGamepad { + SysBusDevice parent_obj; + + uint32_t num_buttons; + qemu_irq *irqs; + uint32_t *keycodes; + uint8_t *pressed; + int extension; +}; #endif diff --git a/hw/arm/stellaris.c b/hw/arm/stellaris.c index 96585dd7106..707b0dae375 100644 --- a/hw/arm/stellaris.c +++ b/hw/arm/stellaris.c @@ -31,6 +31,7 @@ #include "hw/timer/stellaris-gptm.h" #include "hw/qdev-clock.h" #include "qom/object.h" +#include "qapi/qmp/qlist.h" #define GPIO_A 0 #define GPIO_B 1 @@ -1274,16 +1275,27 @@ static void stellaris_init(MachineState *ms, stellaris_board_info *board) sysbus_connect_irq(SYS_BUS_DEVICE(enet), 0, qdev_get_gpio_in(nvic, 42)); } if (board->peripherals & BP_GAMEPAD) { - qemu_irq gpad_irq[5]; + QList *gpad_keycode_list = qlist_new(); static const int gpad_keycode[5] = { 0xc8, 0xd0, 0xcb, 0xcd, 0x1d }; + DeviceState *gpad; - gpad_irq[0] = qemu_irq_invert(gpio_in[GPIO_E][0]); /* up */ - gpad_irq[1] = qemu_irq_invert(gpio_in[GPIO_E][1]); /* down */ - gpad_irq[2] = qemu_irq_invert(gpio_in[GPIO_E][2]); /* left */ - gpad_irq[3] = qemu_irq_invert(gpio_in[GPIO_E][3]); /* right */ - gpad_irq[4] = qemu_irq_invert(gpio_in[GPIO_F][1]); /* select */ + gpad = qdev_new(TYPE_STELLARIS_GAMEPAD); + for (i = 0; i < ARRAY_SIZE(gpad_keycode); i++) { + qlist_append_int(gpad_keycode_list, gpad_keycode[i]); + } + qdev_prop_set_array(gpad, "keycodes", gpad_keycode_list); + sysbus_realize_and_unref(SYS_BUS_DEVICE(gpad), &error_fatal); - stellaris_gamepad_init(5, gpad_irq, gpad_keycode); + qdev_connect_gpio_out(gpad, 0, + qemu_irq_invert(gpio_in[GPIO_E][0])); /* up */ + qdev_connect_gpio_out(gpad, 1, + qemu_irq_invert(gpio_in[GPIO_E][1])); /* down */ + qdev_connect_gpio_out(gpad, 2, + qemu_irq_invert(gpio_in[GPIO_E][2])); /* left */ + qdev_connect_gpio_out(gpad, 3, + qemu_irq_invert(gpio_in[GPIO_E][3])); /* right */ + qdev_connect_gpio_out(gpad, 4, + qemu_irq_invert(gpio_in[GPIO_F][1])); /* select */ } for (i = 0; i < 7; i++) { if (board->dc4 & (1 << i)) { diff --git a/hw/input/stellaris_gamepad.c b/hw/input/stellaris_gamepad.c index 82ddc47a26d..d42ba4f0582 100644 --- a/hw/input/stellaris_gamepad.c +++ b/hw/input/stellaris_gamepad.c @@ -8,19 +8,13 @@ */ #include "qemu/osdep.h" +#include "qapi/error.h" #include "hw/input/stellaris_gamepad.h" #include "hw/irq.h" +#include "hw/qdev-properties.h" #include "migration/vmstate.h" #include "ui/console.h" -typedef struct { - uint32_t num_buttons; - int extension; - qemu_irq *irqs; - uint32_t *keycodes; - uint8_t *pressed; -} StellarisGamepad; - static void stellaris_gamepad_put_key(void * opaque, int keycode) { StellarisGamepad *s = (StellarisGamepad *)opaque; @@ -57,22 +51,52 @@ static const VMStateDescription vmstate_stellaris_gamepad = { } }; -/* Returns an array of 5 output slots. */ -void stellaris_gamepad_init(int n, qemu_irq *irq, const int *keycode) +static void stellaris_gamepad_realize(DeviceState *dev, Error **errp) { - StellarisGamepad *s; - int i; + StellarisGamepad *s = STELLARIS_GAMEPAD(dev); - s = g_new0(StellarisGamepad, 1); - s->irqs = g_new0(qemu_irq, n); - s->keycodes = g_new0(uint32_t, n); - s->pressed = g_new0(uint8_t, n); - for (i = 0; i < n; i++) { - s->irqs[i] = irq[i]; - s->keycodes[i] = keycode[i]; + if (s->num_buttons == 0) { + error_setg(errp, "keycodes property array must be set"); + return; } - s->num_buttons = n; - qemu_add_kbd_event_handler(stellaris_gamepad_put_key, s); - vmstate_register(NULL, VMSTATE_INSTANCE_ID_ANY, - &vmstate_stellaris_gamepad, s); + + s->irqs = g_new0(qemu_irq, s->num_buttons); + s->pressed = g_new0(uint8_t, s->num_buttons); + qdev_init_gpio_out(dev, s->irqs, s->num_buttons); + qemu_add_kbd_event_handler(stellaris_gamepad_put_key, dev); } + +static void stellaris_gamepad_reset_enter(Object *obj, ResetType type) +{ + StellarisGamepad *s = STELLARIS_GAMEPAD(obj); + + memset(s->pressed, 0, s->num_buttons * sizeof(uint8_t)); +} + +static Property stellaris_gamepad_properties[] = { + DEFINE_PROP_ARRAY("keycodes", StellarisGamepad, num_buttons, + keycodes, qdev_prop_uint32, uint32_t), + DEFINE_PROP_END_OF_LIST(), +}; + +static void stellaris_gamepad_class_init(ObjectClass *klass, void *data) +{ + DeviceClass *dc = DEVICE_CLASS(klass); + ResettableClass *rc = RESETTABLE_CLASS(klass); + + rc->phases.enter = stellaris_gamepad_reset_enter; + dc->realize = stellaris_gamepad_realize; + dc->vmsd = &vmstate_stellaris_gamepad; + device_class_set_props(dc, stellaris_gamepad_properties); +} + +static const TypeInfo stellaris_gamepad_info[] = { + { + .name = TYPE_STELLARIS_GAMEPAD, + .parent = TYPE_SYS_BUS_DEVICE, + .instance_size = sizeof(StellarisGamepad), + .class_init = stellaris_gamepad_class_init, + }, +}; + +DEFINE_TYPES(stellaris_gamepad_info); From patchwork Thu Nov 2 17:38:09 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 740450 Delivered-To: patch@linaro.org Received: by 2002:a5d:538f:0:b0:32d:baff:b0ca with SMTP id d15csp961630wrv; Thu, 2 Nov 2023 10:40:12 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHQB2Ffk/IvijSZ89SfH8fb91EGPhN4MNcAO9R6c6rZFGeukcAAzcBg0EWIvXMddqNsHcQm X-Received: by 2002:a05:6870:bb1b:b0:1f0:6565:9a37 with SMTP id nw27-20020a056870bb1b00b001f065659a37mr1128056oab.50.1698946812643; Thu, 02 Nov 2023 10:40:12 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1698946812; cv=none; d=google.com; s=arc-20160816; b=D6Vy8nLbUEhNBlW6pLoyOCZnUjqw1irR5sgmMtBSDhElydVqEVHnFTvNwJKo3dZ4JK Y3WB2JswQeXuDuey619/TkqVYSALhc2psJrs8lKDME0lXI+xl0KPJfGi9VVfqr3kh8c3 sPj7obSqSZNL96JTZuemPv8SEd/854tRuE3TCJ9fTTblayC73AlpjUHmtluEnx+GyoML ymQnHAi6bDsdxoV2EO37IoGSNIEZt81CdEVB++UlHfCZtgFDxqt1xitjeDAEmOB8+xOg NdtoKM4yd3iXnK1S23W1Agnmf3p46X0453E0103v706dsXsFdHTViiBMTV37lU3pS/DM KbhA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:to:from :dkim-signature; bh=ldh6u2bWD7MniqjxzXyQCd0Qu18ZZOjaa+NiKkpmJMc=; fh=PnYt+qEB9tAfMKoqBm2xjKOFpYyFFGPudh5cVIoieJM=; b=z+Ah2ZUQcBWzgHQe7HszERMhiCjYBgingGQnmkgIEcBVBkG42JCIwF4nmQm5fp9mST Iy1V8wL3j9Qr2CeAvElCHgYKfY7IMKF2pPst05JSRAQnqtu2MjD0WFf2yHiq+ccSeMbY hHcjel3kGvj1Da4UBQEaQN09Xes9ZRG+YTWkcr5++dw6O8vppypdiDRElnpLTCMGk87Z Z6tDWRIf4WR+jZYYTzBJQuWIBXo2oYovXrcCN4V3/QsYSBlvxAjBcIuk0sN8vrrbY+yY yBcR6Efg35amSr/+W/RaictL1scsjB5nkc72Eh9lESKSxnbVqqd1JwlSUSoh+thygjt+ CYWA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=cBlwRk1J; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id t7-20020a0cef07000000b0065d8846dd43si296472qvr.192.2023.11.02.10.40.12 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Thu, 02 Nov 2023 10:40:12 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=cBlwRk1J; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qybed-0003E2-J8; Thu, 02 Nov 2023 13:38:51 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qybeZ-0003B5-2K for qemu-devel@nongnu.org; Thu, 02 Nov 2023 13:38:47 -0400 Received: from mail-wr1-x430.google.com ([2a00:1450:4864:20::430]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qybeU-0002hl-1f for qemu-devel@nongnu.org; Thu, 02 Nov 2023 13:38:46 -0400 Received: by mail-wr1-x430.google.com with SMTP id ffacd0b85a97d-32f7bd27c2aso800834f8f.2 for ; Thu, 02 Nov 2023 10:38:41 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1698946720; x=1699551520; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:from:to:cc:subject:date:message-id :reply-to; bh=ldh6u2bWD7MniqjxzXyQCd0Qu18ZZOjaa+NiKkpmJMc=; b=cBlwRk1Jy+D4+IBixNtu65/lD/F2onN46RsgX4CR17m6sTJHc9UA9KHYS26oU+TczM jDESvAb9p3C8Xvqhfu0SXiUzvYf8cxoRRCx7u1XAOaxB863OZv3S4kmZtv+QZChAXJ19 2NB143plXon1LGnldQ7+8pk7lRghki3uxtn8Gei1qx1dr8yUj1tjHLTDtNIm8U21u657 DDm6MIDyNagGJY+2jrLWjE8eQzoC1qce6wTo1dHAcdEs71VnNciHdJscXyH1JCI6pLPd NlAonITdCpqlfX3nL4dJc/4lAO/POeFoHg61tj8uSIsQqXC2tw7aW4D/41o6abtN3pxn I9lg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1698946720; x=1699551520; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=ldh6u2bWD7MniqjxzXyQCd0Qu18ZZOjaa+NiKkpmJMc=; b=RruOOyN6pAJmIBgsHc1JQUBMeWd34aQU2U2CQbyJEPgX2GtD2rYDb/B7oMkLtl1UjA obq2hYnyiI4xOAxvSJi+DCC9FIYEIVIsisKZsTaRtcMcXcfBgLEvkTRI8QkGV464XnP2 oUvOiJQartlW1JQudjCNCAgJ4fe0Ax18GD/m1JlmaW4n1RE8zNAeHExo0PL/ihu0mMli sS5E2nruMD//6VjbQj6eTQHQwGS5Asa4jMmjX1k1HFNsWMGXzax0FWQup/E5GU4SoL7r DxMVuUPhULFRO2QOpchv2rUu/oFfPchxdeB2YhsVRIb2PC4uxZSYWt9Oy5K4V38e7VoI 3iCg== X-Gm-Message-State: AOJu0YyfwbL4A/SFO9LovMw2/q1tKV2wSVvxrwVhlw3L2LF7znH6pjts e6DqKmMnLeUTRu3ks0/QdJxl7emwahkdgzgi4xc= X-Received: by 2002:a5d:5887:0:b0:32f:7a07:be03 with SMTP id n7-20020a5d5887000000b0032f7a07be03mr14178010wrf.13.1698946720650; Thu, 02 Nov 2023 10:38:40 -0700 (PDT) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [2001:8b0:1d0::2]) by smtp.gmail.com with ESMTPSA id e16-20020adff350000000b003258934a4bcsm3046805wrp.42.2023.11.02.10.38.40 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 02 Nov 2023 10:38:40 -0700 (PDT) From: Peter Maydell To: qemu-devel@nongnu.org Subject: [PULL 07/33] hw/input/stellaris_gamepad: Convert to qemu_input_handler_register() Date: Thu, 2 Nov 2023 17:38:09 +0000 Message-Id: <20231102173835.609985-8-peter.maydell@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231102173835.609985-1-peter.maydell@linaro.org> References: <20231102173835.609985-1-peter.maydell@linaro.org> MIME-Version: 1.0 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, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org Now that we have converted to qdev, we can use the newer qemu_input_handler_register() API rather than the legacy qemu_add_kbd_event_handler(). Since we only have one user, take the opportunity to convert from scancodes to QCodes, rather than using qemu_input_key_value_to_scancode() (which adds an 0xe0 prefix and encodes up/down indication in the scancode, which our old handler function then had to reverse). That lets us drop the old state field which was tracking whether we were halfway through a two-byte scancode. Signed-off-by: Peter Maydell Reviewed-by: Philippe Mathieu-Daudé Tested-by: Philippe Mathieu-Daudé Message-id: 20231030114802.3671871-7-peter.maydell@linaro.org --- include/hw/input/stellaris_gamepad.h | 2 +- hw/arm/stellaris.c | 6 ++++- hw/input/stellaris_gamepad.c | 37 +++++++++++++--------------- 3 files changed, 23 insertions(+), 22 deletions(-) diff --git a/include/hw/input/stellaris_gamepad.h b/include/hw/input/stellaris_gamepad.h index d6a6aecb06d..51085e166ca 100644 --- a/include/hw/input/stellaris_gamepad.h +++ b/include/hw/input/stellaris_gamepad.h @@ -17,6 +17,7 @@ /* * QEMU interface: * + QOM array property "keycodes": uint32_t QEMU keycodes to handle + * (these are QCodes, ie the Q_KEY_* values) * + unnamed GPIO outputs: one per keycode, in the same order as the * "keycodes" array property entries; asserted when key is down */ @@ -31,7 +32,6 @@ struct StellarisGamepad { qemu_irq *irqs; uint32_t *keycodes; uint8_t *pressed; - int extension; }; #endif diff --git a/hw/arm/stellaris.c b/hw/arm/stellaris.c index 707b0dae375..dd90f686bfa 100644 --- a/hw/arm/stellaris.c +++ b/hw/arm/stellaris.c @@ -32,6 +32,7 @@ #include "hw/qdev-clock.h" #include "qom/object.h" #include "qapi/qmp/qlist.h" +#include "ui/input.h" #define GPIO_A 0 #define GPIO_B 1 @@ -1276,7 +1277,10 @@ static void stellaris_init(MachineState *ms, stellaris_board_info *board) } if (board->peripherals & BP_GAMEPAD) { QList *gpad_keycode_list = qlist_new(); - static const int gpad_keycode[5] = { 0xc8, 0xd0, 0xcb, 0xcd, 0x1d }; + static const int gpad_keycode[5] = { + Q_KEY_CODE_UP, Q_KEY_CODE_DOWN, Q_KEY_CODE_LEFT, + Q_KEY_CODE_RIGHT, Q_KEY_CODE_CTRL, + }; DeviceState *gpad; gpad = qdev_new(TYPE_STELLARIS_GAMEPAD); diff --git a/hw/input/stellaris_gamepad.c b/hw/input/stellaris_gamepad.c index d42ba4f0582..06a0c0ce839 100644 --- a/hw/input/stellaris_gamepad.c +++ b/hw/input/stellaris_gamepad.c @@ -15,42 +15,39 @@ #include "migration/vmstate.h" #include "ui/console.h" -static void stellaris_gamepad_put_key(void * opaque, int keycode) +static void stellaris_gamepad_event(DeviceState *dev, QemuConsole *src, + InputEvent *evt) { - StellarisGamepad *s = (StellarisGamepad *)opaque; + StellarisGamepad *s = STELLARIS_GAMEPAD(dev); + InputKeyEvent *key = evt->u.key.data; + int qcode = qemu_input_key_value_to_qcode(key->key); int i; - int down; - - if (keycode == 0xe0 && !s->extension) { - s->extension = 0x80; - return; - } - - down = (keycode & 0x80) == 0; - keycode = (keycode & 0x7f) | s->extension; for (i = 0; i < s->num_buttons; i++) { - if (s->keycodes[i] == keycode && s->pressed[i] != down) { - s->pressed[i] = down; - qemu_set_irq(s->irqs[i], down); + if (s->keycodes[i] == qcode && s->pressed[i] != key->down) { + s->pressed[i] = key->down; + qemu_set_irq(s->irqs[i], key->down); } } - - s->extension = 0; } static const VMStateDescription vmstate_stellaris_gamepad = { .name = "stellaris_gamepad", - .version_id = 3, - .minimum_version_id = 3, + .version_id = 4, + .minimum_version_id = 4, .fields = (VMStateField[]) { - VMSTATE_INT32(extension, StellarisGamepad), VMSTATE_VARRAY_UINT32(pressed, StellarisGamepad, num_buttons, 0, vmstate_info_uint8, uint8_t), VMSTATE_END_OF_LIST() } }; +static const QemuInputHandler stellaris_gamepad_handler = { + .name = "Stellaris Gamepad", + .mask = INPUT_EVENT_MASK_KEY, + .event = stellaris_gamepad_event, +}; + static void stellaris_gamepad_realize(DeviceState *dev, Error **errp) { StellarisGamepad *s = STELLARIS_GAMEPAD(dev); @@ -63,7 +60,7 @@ static void stellaris_gamepad_realize(DeviceState *dev, Error **errp) s->irqs = g_new0(qemu_irq, s->num_buttons); s->pressed = g_new0(uint8_t, s->num_buttons); qdev_init_gpio_out(dev, s->irqs, s->num_buttons); - qemu_add_kbd_event_handler(stellaris_gamepad_put_key, dev); + qemu_input_handler_register(dev, &stellaris_gamepad_handler); } static void stellaris_gamepad_reset_enter(Object *obj, ResetType type) From patchwork Thu Nov 2 17:38:10 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 740469 Delivered-To: patch@linaro.org Received: by 2002:a5d:538f:0:b0:32d:baff:b0ca with SMTP id d15csp962624wrv; Thu, 2 Nov 2023 10:42:34 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHir9JGWes2FnumQY4JuF/Zl9MyirGboKIV73r1m5ixRGWVKRcK69AK4ebhIdUJ4wBJtrxa X-Received: by 2002:a05:6512:3282:b0:503:28cb:c087 with SMTP id p2-20020a056512328200b0050328cbc087mr13954177lfe.29.1698946953942; Thu, 02 Nov 2023 10:42:33 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1698946953; cv=none; d=google.com; s=arc-20160816; b=xLsseyIuGRdKk5Xr2RHwoXjW/V+MI48JJFQg5I7UNBiRkooonJst3timVEXO+39xtx 5P8mTja+zTtLA7TRsUO3WexulJxPBy09yyD75l8u3zmEzrCmAF20RzMeEp1Al5ROGJc0 Q7pDy1q2St2GEUGIWvSxxf30vbw7e9B8iWxgXGNGErmZI78Cgfiow6NNxKKJqQnHRNsf ZvY9he+goY2s07BbMnxtkZCPBvEL+haom3M/+Hjxazue6uNz/1aIrh47f/HTxf/XE/sA lTJquz6OKW/SGCyYOBD5LXptzx1cFjspXHZG2vGIEuC1s68Uk8pexTggg1IXS8lgeEqE R1Ag== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:to:from :dkim-signature; bh=SskojryoeBaNET044RrLqzmul/SzDPe7Qrix3P3iV6A=; fh=PnYt+qEB9tAfMKoqBm2xjKOFpYyFFGPudh5cVIoieJM=; b=JRGcaIxYAspxOBFCKPV3c54gGCFn80mSS1GTPrv4hveCUyJyj3ntUc9/uJZ7OSV06S VTWATo1MHu6LE/7hUhsrsCY9xoIZhtKWgSVqoOay9jDdZAV+m+/SAdFG/HS7PPypxFl7 pPnpnz0lPIPqL0r8vddPhlxKfGrk0oPQGjjrbeodX0pZq0i0MSzznjCiUFmZFP6gkah8 jLjIduHMW3HNao1qsi8nqvg+aSisEATJnsWtdPfwGxIj6JR8mcFY2DoLcgSo5Vz/uIpJ UEgs+hs6JlCAiotqyAnmRAjnfAsa2aeCoIJ0S0nEiiaMabgey5Cu+sJbmfBn4cvBaZ86 N/NA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=Lbw99UXg; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id n35-20020a05600c3ba300b0040645f86d61si1965291wms.139.2023.11.02.10.42.33 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Thu, 02 Nov 2023 10:42:33 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=Lbw99UXg; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qybes-0003NB-Ao; Thu, 02 Nov 2023 13:39:06 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qybea-0003CO-85 for qemu-devel@nongnu.org; Thu, 02 Nov 2023 13:38:48 -0400 Received: from mail-wm1-x336.google.com ([2a00:1450:4864:20::336]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qybeU-0002iE-TX for qemu-devel@nongnu.org; Thu, 02 Nov 2023 13:38:47 -0400 Received: by mail-wm1-x336.google.com with SMTP id 5b1f17b1804b1-40838915cecso8911325e9.2 for ; Thu, 02 Nov 2023 10:38:42 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1698946721; x=1699551521; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:from:to:cc:subject:date:message-id :reply-to; bh=SskojryoeBaNET044RrLqzmul/SzDPe7Qrix3P3iV6A=; b=Lbw99UXgBzx1zpvzWitOWqHZJjOmtArgBnQ2+bkllEYdrCEF3xFxtC2TvZ66iS8LXs TRQLPztT1eYq8NpnbCQ2wH65d8tgjeISOXzWPwpfaWU6rDUtH+XVAAjCqTz5XrGGfJvD Wcrh1jIyyGUcOnxyIBSiB8654x/M28x1lQHQZIkdZTz7oG70zBBGJ0LmUFb3Z8ZKbjLg dZxgU1fbYWI5C1fDgnD+PPTWGe6Tzc+s4Hkss1b98NCco3oAUmeuAx33lIixG3ngjpt6 vWMFbA2GoLSVCB1j/XI3b/BRd8JmgYA+LmvxaHSeFlj7sPyDuDtSCGPZjkp2tsOZFryT 74Iw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1698946721; x=1699551521; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=SskojryoeBaNET044RrLqzmul/SzDPe7Qrix3P3iV6A=; b=YzsTIh2L5wZDOnHlzItfC+Oo11S2wArJZUhYN/USL/Wr8P0Dfuu0GOv5DAWHKDCqOM IfW832mZERTrO8z+swcMTOhXErMo+0+tv5xrN+Xh4IiEWReq43KosQ7vm9E818piDJHT xoFgq4ckZWzQt5HSyk/NVaJBetRAClxAFyJidgdWeKffSdNvcD8boeXhGJavrhq57Ok6 f69VdwrrgCF31VNHUbEQY+Y+e0Gmmt8/7n5HB9hN38jfIAGorRvnpg0eFj1Zx7a4Nb4E /EyoP11i75CSgFcmGzQE9wigUlpijbhcATuubOWlzeD4pVpkG50pGDC4pbuQibgSLkq8 oa2A== X-Gm-Message-State: AOJu0YxTydS8QljPGNK8q59pqeg/XZRY4HDvtA3shu9TSpF8ARUUz5vX TMNi6l7WSmwdm0Vx2eUFPQ5e9UVZ9tNcnBM8/zE= X-Received: by 2002:a05:600c:5250:b0:409:5a92:4718 with SMTP id fc16-20020a05600c525000b004095a924718mr4542905wmb.36.1698946721228; Thu, 02 Nov 2023 10:38:41 -0700 (PDT) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [2001:8b0:1d0::2]) by smtp.gmail.com with ESMTPSA id e16-20020adff350000000b003258934a4bcsm3046805wrp.42.2023.11.02.10.38.40 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 02 Nov 2023 10:38:40 -0700 (PDT) From: Peter Maydell To: qemu-devel@nongnu.org Subject: [PULL 08/33] docs/specs/vmw_pvscsi-spec: Convert to rST Date: Thu, 2 Nov 2023 17:38:10 +0000 Message-Id: <20231102173835.609985-9-peter.maydell@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231102173835.609985-1-peter.maydell@linaro.org> References: <20231102173835.609985-1-peter.maydell@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::336; envelope-from=peter.maydell@linaro.org; helo=mail-wm1-x336.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, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org Convert the docs/specs/vmw_pvscsi-spec.txt file to rST format. This conversion includes some minor wordsmithing of the text to fix some grammar nits. Signed-off-by: Peter Maydell Reviewed-by: Thomas Huth Message-id: 20230927151205.70930-2-peter.maydell@linaro.org --- MAINTAINERS | 1 + docs/specs/index.rst | 1 + docs/specs/vmw_pvscsi-spec.rst | 115 +++++++++++++++++++++++++++++++++ docs/specs/vmw_pvscsi-spec.txt | 92 -------------------------- 4 files changed, 117 insertions(+), 92 deletions(-) create mode 100644 docs/specs/vmw_pvscsi-spec.rst delete mode 100644 docs/specs/vmw_pvscsi-spec.txt diff --git a/MAINTAINERS b/MAINTAINERS index 018ed62560f..73ec940bea0 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -2350,6 +2350,7 @@ S: Maintained F: hw/net/vmxnet* F: hw/scsi/vmw_pvscsi* F: tests/qtest/vmxnet3-test.c +F: docs/specs/vwm_pvscsi-spec.rst Rocker M: Jiri Pirko diff --git a/docs/specs/index.rst b/docs/specs/index.rst index e58be38c41c..d23efbe2480 100644 --- a/docs/specs/index.rst +++ b/docs/specs/index.rst @@ -24,3 +24,4 @@ guest hardware that is specific to QEMU. acpi_erst sev-guest-firmware fw_cfg + vmw_pvscsi-spec diff --git a/docs/specs/vmw_pvscsi-spec.rst b/docs/specs/vmw_pvscsi-spec.rst new file mode 100644 index 00000000000..b6f434a4187 --- /dev/null +++ b/docs/specs/vmw_pvscsi-spec.rst @@ -0,0 +1,115 @@ +============================== +VMWare PVSCSI Device Interface +============================== + +.. + Created by Dmitry Fleytman (dmitry@daynix.com), Daynix Computing LTD. + +This document describes the VMWare PVSCSI device interface specification, +based on the source code of the PVSCSI Linux driver from kernel 3.0.4. + +Overview +======== + +The interface is based on a memory area shared between hypervisor and VM. +The memory area is obtained by driver as a device IO memory resource of +``PVSCSI_MEM_SPACE_SIZE`` length. +The shared memory consists of a registers area and a rings area. +The registers area is used to raise hypervisor interrupts and issue device +commands. The rings area is used to transfer data descriptors and SCSI +commands from VM to hypervisor and to transfer messages produced by +hypervisor to VM. Data itself is transferred via virtual scatter-gather DMA. + +PVSCSI Device Registers +======================= + +The length of the registers area is 1 page +(``PVSCSI_MEM_SPACE_COMMAND_NUM_PAGES``). The structure of the +registers area is described by the ``PVSCSIRegOffset`` enum. There +are registers to issue device commands (with optional short data), +issue device interrupts, and control interrupt masking. + +PVSCSI Device Rings +=================== + +There are three rings in shared memory: + +Request ring (``struct PVSCSIRingReqDesc *req_ring``) + ring for OS to device requests + +Completion ring (``struct PVSCSIRingCmpDesc *cmp_ring``) + ring for device request completions + +Message ring (``struct PVSCSIRingMsgDesc *msg_ring``) + ring for messages from device. This ring is optional and the + guest might not configure it. + +There is a control area (``struct PVSCSIRingsState *rings_state``) +used to control rings operation. + +PVSCSI Device to Host Interrupts +================================ + +The following interrupt types are supported by the PVSCSI device: + +Completion interrupts (completion ring notifications): + +- ``PVSCSI_INTR_CMPL_0`` +- ``PVSCSI_INTR_CMPL_1`` + +Message interrupts (message ring notifications): + +- ``PVSCSI_INTR_MSG_0`` +- ``PVSCSI_INTR_MSG_1`` + +Interrupts are controlled via the ``PVSCSI_REG_OFFSET_INTR_MASK`` +register. If a bit is set it means the interrupt is enabled, and if +it is clear then the interrupt is disabled. + +The interrupt modes supported are legacy, MSI and MSI-X. +In the case of legacy interrupts, the ``PVSCSI_REG_OFFSET_INTR_STATUS`` +register is used to check which interrupt has arrived. Interrupts are +acknowledged when the corresponding bit is written to the interrupt +status register. + +PVSCSI Device Operation Sequences +================================= + +Startup sequence +---------------- + +a. Issue ``PVSCSI_CMD_ADAPTER_RESET`` command +b. Windows driver reads interrupt status register here +c. Issue ``PVSCSI_CMD_SETUP_MSG_RING`` command with no additional data, + check status and disable device messages if error returned + (Omitted if device messages disabled by driver configuration) +d. Issue ``PVSCSI_CMD_SETUP_RINGS`` command, provide rings configuration + as ``struct PVSCSICmdDescSetupRings`` +e. Issue ``PVSCSI_CMD_SETUP_MSG_RING`` command again, provide + rings configuration as ``struct PVSCSICmdDescSetupMsgRing`` +f. Unmask completion and message (if device messages enabled) interrupts + +Shutdown sequence +----------------- + +a. Mask interrupts +b. Flush request ring using ``PVSCSI_REG_OFFSET_KICK_NON_RW_IO`` +c. Issue ``PVSCSI_CMD_ADAPTER_RESET`` command + +Send request +------------ + +a. Fill next free request ring descriptor +b. Issue ``PVSCSI_REG_OFFSET_KICK_RW_IO`` for R/W operations + or ``PVSCSI_REG_OFFSET_KICK_NON_RW_IO`` for other operations + +Abort command +------------- + +a. Issue ``PVSCSI_CMD_ABORT_CMD`` command + +Request completion processing +----------------------------- + +a. Upon completion interrupt arrival process completion + and message (if enabled) rings diff --git a/docs/specs/vmw_pvscsi-spec.txt b/docs/specs/vmw_pvscsi-spec.txt deleted file mode 100644 index 49affb2a423..00000000000 --- a/docs/specs/vmw_pvscsi-spec.txt +++ /dev/null @@ -1,92 +0,0 @@ -General Description -=================== - -This document describes VMWare PVSCSI device interface specification. -Created by Dmitry Fleytman (dmitry@daynix.com), Daynix Computing LTD. -Based on source code of PVSCSI Linux driver from kernel 3.0.4 - -PVSCSI Device Interface Overview -================================ - -The interface is based on memory area shared between hypervisor and VM. -Memory area is obtained by driver as device IO memory resource of -PVSCSI_MEM_SPACE_SIZE length. -The shared memory consists of registers area and rings area. -The registers area is used to raise hypervisor interrupts and issue device -commands. The rings area is used to transfer data descriptors and SCSI -commands from VM to hypervisor and to transfer messages produced by -hypervisor to VM. Data itself is transferred via virtual scatter-gather DMA. - -PVSCSI Device Registers -======================= - -The length of the registers area is 1 page (PVSCSI_MEM_SPACE_COMMAND_NUM_PAGES). -The structure of the registers area is described by the PVSCSIRegOffset enum. -There are registers to issue device command (with optional short data), -issue device interrupt, control interrupts masking. - -PVSCSI Device Rings -=================== - -There are three rings in shared memory: - - 1. Request ring (struct PVSCSIRingReqDesc *req_ring) - - ring for OS to device requests - 2. Completion ring (struct PVSCSIRingCmpDesc *cmp_ring) - - ring for device request completions - 3. Message ring (struct PVSCSIRingMsgDesc *msg_ring) - - ring for messages from device. - This ring is optional and the guest might not configure it. -There is a control area (struct PVSCSIRingsState *rings_state) used to control -rings operation. - -PVSCSI Device to Host Interrupts -================================ -There are following interrupt types supported by PVSCSI device: - 1. Completion interrupts (completion ring notifications): - PVSCSI_INTR_CMPL_0 - PVSCSI_INTR_CMPL_1 - 2. Message interrupts (message ring notifications): - PVSCSI_INTR_MSG_0 - PVSCSI_INTR_MSG_1 - -Interrupts are controlled via PVSCSI_REG_OFFSET_INTR_MASK register -Bit set means interrupt enabled, bit cleared - disabled - -Interrupt modes supported are legacy, MSI and MSI-X -In case of legacy interrupts, register PVSCSI_REG_OFFSET_INTR_STATUS -is used to check which interrupt has arrived. Interrupts are -acknowledged when the corresponding bit is written to the interrupt -status register. - -PVSCSI Device Operation Sequences -================================= - -1. Startup sequence: - a. Issue PVSCSI_CMD_ADAPTER_RESET command; - aa. Windows driver reads interrupt status register here; - b. Issue PVSCSI_CMD_SETUP_MSG_RING command with no additional data, - check status and disable device messages if error returned; - (Omitted if device messages disabled by driver configuration) - c. Issue PVSCSI_CMD_SETUP_RINGS command, provide rings configuration - as struct PVSCSICmdDescSetupRings; - d. Issue PVSCSI_CMD_SETUP_MSG_RING command again, provide - rings configuration as struct PVSCSICmdDescSetupMsgRing; - e. Unmask completion and message (if device messages enabled) interrupts. - -2. Shutdown sequences - a. Mask interrupts; - b. Flush request ring using PVSCSI_REG_OFFSET_KICK_NON_RW_IO; - c. Issue PVSCSI_CMD_ADAPTER_RESET command. - -3. Send request - a. Fill next free request ring descriptor; - b. Issue PVSCSI_REG_OFFSET_KICK_RW_IO for R/W operations; - or PVSCSI_REG_OFFSET_KICK_NON_RW_IO for other operations. - -4. Abort command - a. Issue PVSCSI_CMD_ABORT_CMD command; - -5. Request completion processing - a. Upon completion interrupt arrival process completion - and message (if enabled) rings. From patchwork Thu Nov 2 17:38:11 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 740451 Delivered-To: patch@linaro.org Received: by 2002:a5d:538f:0:b0:32d:baff:b0ca with SMTP id d15csp961742wrv; Thu, 2 Nov 2023 10:40:27 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGdiWL+h5P5hz6U/i/X7s+1SYMFgO6WIMKHPbGMO4da2y5MfrnpCF1Whnqozeuf7oxzKxkV X-Received: by 2002:a05:620a:1aa2:b0:76f:1268:9e26 with SMTP id bl34-20020a05620a1aa200b0076f12689e26mr22568826qkb.24.1698946827420; Thu, 02 Nov 2023 10:40:27 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1698946827; cv=none; d=google.com; s=arc-20160816; b=RTMpt6yMZTsaTycs010ZALAfC1xqUAtiPYfHJdMYky1Ht2B9jp3UVBhikGBH9X5kd+ iRRSHv8pd6MmsYTNJudUU+q1AVx7BnnxaTbsQ8bO7M0kFjL/iM/Q68GFa1qONo3RZstK TkooDVX8KNnQlT/TKg4U5sUykRPKyadb2Ng/qycx0yaRSh5/yvaXSggw4RFdveqGidLh wzS0WAay7bC687/KRFkwGfGZGpHQQeGG5at6ZKaQ/9VWaymkMXpDlBKHYgfTp892S/gE MSrms31HTzF+iuchoufjdAt9tars5Fe3HfBoO8VEuWQc3kLQ0X42ADuAMRFPch5q2sD6 yVsg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:to:from :dkim-signature; bh=ec1nL91WJ0scl8pDrGtNON2/Nq+ssKE+wY9dEhgeD6s=; fh=PnYt+qEB9tAfMKoqBm2xjKOFpYyFFGPudh5cVIoieJM=; b=ROAg6WLmX2Xste7xhYwm52lHa2XjUYlcnQttWFZGDrxHCR/GdWhr3x1QJRZ4KvfCiV PD//oapUgL7WCAOPf9xH9QIqqrb8AG9SOrcCXOFsGSXj5F/dm9LaJy0O8mCOf/Kwwx46 nLTlnxSGXilF5+vaGHpNUP15rcEp25nUqbyDlVgIGFkVuz4AuQIYxlFM1vRcptR/lNdz +wAmY3LHnZsu0kvE/tUcoXl/R1mIKPqsHGIh5mji0SQ6tcUSmtx6M/UqFT43sJLepik8 VjZHHogMkKSrmqBNZHYLaRinaSTJbQfE+B8/6AIh2MhhbrKTzmAfihz3H07Uly9aWYcu vBcQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=a64F95qO; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id y4-20020a05620a44c400b0077412011692si327692qkp.18.2023.11.02.10.40.27 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Thu, 02 Nov 2023 10:40:27 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=a64F95qO; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qybfD-0003P8-Ek; Thu, 02 Nov 2023 13:39:28 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qybeb-0003Cu-R6 for qemu-devel@nongnu.org; Thu, 02 Nov 2023 13:38:50 -0400 Received: from mail-wr1-x436.google.com ([2a00:1450:4864:20::436]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qybeW-0002iH-0T for qemu-devel@nongnu.org; Thu, 02 Nov 2023 13:38:48 -0400 Received: by mail-wr1-x436.google.com with SMTP id ffacd0b85a97d-32f7c80ab33so705189f8f.0 for ; Thu, 02 Nov 2023 10:38:42 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1698946721; x=1699551521; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:from:to:cc:subject:date:message-id :reply-to; bh=ec1nL91WJ0scl8pDrGtNON2/Nq+ssKE+wY9dEhgeD6s=; b=a64F95qO6pEWsNMWNdswO+5Cbn3Nf63SmbOiJ7eKaPi5ROY/WuIEap35Hottj4zInN aeBuyg/YR3Uew+xcRBU3pNqW1LSiw1a4/jxmfkfebbtAi0ipdHsD8rdpIUbDnNAW5i88 +Eie9qhvh1Bx0jR7/8ngc1oUtos7iqGiWdA8DJ2FeIYkRnolu7ExoDTuFpBZnXBkzVmU GZFpHhVNHJLPATlTBcvPZigb79aR+zXJwHA1JZ7Mv5DToTB5oOGt3p23HA46T5yxFSlP f88MVdQw/7g/PS7SapfXh47my0Q4wo0b4tHrOFsPyrALIFk5ogXEa9kMMKySrbhula/I KyZA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1698946721; x=1699551521; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=ec1nL91WJ0scl8pDrGtNON2/Nq+ssKE+wY9dEhgeD6s=; b=qZ4fCaMCO/gsep68nYy7u1dVipP5gl/DG9dDTqC/hmy78teHLgIIvy5FCRmOeGPhsH n8bD/mPumYbdgA8Pkscfi98PaXA5iTT9nz66n1rAuH/XzeLM/beMuzy0DmPLPCkUK4MS Va8u51PMREvF+NX08xs7tr/Sb6nX76HCcbTeISOZN9imkbfi0c2pZOG4oOeogLhU5F7o 3TohvI/6xHby7tH3G6HNFDuXDTqum/fhh/nnF6TOt/dB+hsd38M110fdx3MOwiIOqjv1 bQRDEr/nsxgcHGTVYD4Mp2Xo/v8qLh8npml63/ylDViD70jh9sn0ccJdpKoICSMVo8tE g5Tg== X-Gm-Message-State: AOJu0YyNoR22sM2LE7y0fDwlsdgfs3j5cc6oIZqtQ/ZvgA6jruMNGVRU RO+mEJll1QPeGX5drcz3lAj9ALQtr80sarDuCGE= X-Received: by 2002:a5d:64ad:0:b0:32f:7867:11b with SMTP id m13-20020a5d64ad000000b0032f7867011bmr16504117wrp.29.1698946721678; Thu, 02 Nov 2023 10:38:41 -0700 (PDT) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [2001:8b0:1d0::2]) by smtp.gmail.com with ESMTPSA id e16-20020adff350000000b003258934a4bcsm3046805wrp.42.2023.11.02.10.38.41 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 02 Nov 2023 10:38:41 -0700 (PDT) From: Peter Maydell To: qemu-devel@nongnu.org Subject: [PULL 09/33] docs/specs/edu: Convert to rST Date: Thu, 2 Nov 2023 17:38:11 +0000 Message-Id: <20231102173835.609985-10-peter.maydell@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231102173835.609985-1-peter.maydell@linaro.org> References: <20231102173835.609985-1-peter.maydell@linaro.org> MIME-Version: 1.0 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, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org Convert docs/specs/edu.txt to rST format. Signed-off-by: Peter Maydell Reviewed-by: Thomas Huth Message-id: 20230927151205.70930-3-peter.maydell@linaro.org --- MAINTAINERS | 1 + docs/specs/{edu.txt => edu.rst} | 84 ++++++++++++++++++++------------- docs/specs/index.rst | 1 + 3 files changed, 54 insertions(+), 32 deletions(-) rename docs/specs/{edu.txt => edu.rst} (64%) diff --git a/MAINTAINERS b/MAINTAINERS index 73ec940bea0..8e10bd085ff 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -1882,6 +1882,7 @@ EDU M: Jiri Slaby S: Maintained F: hw/misc/edu.c +F: docs/specs/edu.rst IDE M: John Snow diff --git a/docs/specs/edu.txt b/docs/specs/edu.rst similarity index 64% rename from docs/specs/edu.txt rename to docs/specs/edu.rst index 08763108099..ae72737dbb4 100644 --- a/docs/specs/edu.txt +++ b/docs/specs/edu.rst @@ -2,9 +2,10 @@ EDU device ========== -Copyright (c) 2014-2015 Jiri Slaby +.. + Copyright (c) 2014-2015 Jiri Slaby -This document is licensed under the GPLv2 (or later). + This document is licensed under the GPLv2 (or later). This is an educational device for writing (kernel) drivers. Its original intention was to support the Linux kernel lectures taught at the Masaryk @@ -15,10 +16,11 @@ The devices behaves very similar to the PCI bridge present in the COMBO6 cards developed under the Liberouter wings. Both PCI device ID and PCI space is inherited from that device. -Command line switches: - -device edu[,dma_mask=mask] +Command line switches +--------------------- - dma_mask makes the virtual device work with DMA addresses with the given +``-device edu[,dma_mask=mask]`` + ``dma_mask`` makes the virtual device work with DMA addresses with the given mask. For educational purposes, the device supports only 28 bits (256 MiB) by default. Students shall set dma_mask for the device in the OS driver properly. @@ -26,7 +28,8 @@ Command line switches: PCI specs --------- -PCI ID: 1234:11e8 +PCI ID: + ``1234:11e8`` PCI Region 0: I/O memory, 1 MB in size. Users are supposed to communicate with the card @@ -35,24 +38,29 @@ PCI Region 0: MMIO area spec -------------- -Only size == 4 accesses are allowed for addresses < 0x80. size == 4 or -size == 8 for the rest. +Only ``size == 4`` accesses are allowed for addresses ``< 0x80``. +``size == 4`` or ``size == 8`` for the rest. -0x00 (RO) : identification (0xRRrr00edu) - RR -- major version - rr -- minor version +0x00 (RO) : identification + Value is in the form ``0xRRrr00edu`` where: + - ``RR`` -- major version + - ``rr`` -- minor version 0x04 (RW) : card liveness check - It is a simple value inversion (~ C operator). + It is a simple value inversion (``~`` C operator). 0x08 (RW) : factorial computation The stored value is taken and factorial of it is put back here. This happens only after factorial bit in the status register (0x20 below) is cleared. -0x20 (RW) : status register, bitwise OR - 0x01 -- computing factorial (RO) - 0x80 -- raise interrupt after finishing factorial computation +0x20 (RW) : status register + Bitwise OR of: + + 0x01 + computing factorial (RO) + 0x80 + raise interrupt after finishing factorial computation 0x24 (RO) : interrupt status register It contains values which raised the interrupt (see interrupt raise @@ -76,13 +84,19 @@ size == 8 for the rest. 0x90 (RW) : DMA transfer count The size of the area to perform the DMA on. -0x98 (RW) : DMA command register, bitwise OR - 0x01 -- start transfer - 0x02 -- direction (0: from RAM to EDU, 1: from EDU to RAM) - 0x04 -- raise interrupt 0x100 after finishing the DMA +0x98 (RW) : DMA command register + Bitwise OR of: + + 0x01 + start transfer + 0x02 + direction (0: from RAM to EDU, 1: from EDU to RAM) + 0x04 + raise interrupt 0x100 after finishing the DMA IRQ controller -------------- + An IRQ is generated when written to the interrupt raise register. The value appears in interrupt status register when the interrupt is raised and has to be written to the interrupt acknowledge register to lower it. @@ -94,22 +108,28 @@ routine. DMA controller -------------- + One has to specify, source, destination, size, and start the transfer. One 4096 bytes long buffer at offset 0x40000 is available in the EDU device. I.e. one can perform DMA to/from this space when programmed properly. Example of transferring a 100 byte block to and from the buffer using a given -PCI address 'addr': -addr -> DMA source address -0x40000 -> DMA destination address -100 -> DMA transfer count -1 -> DMA command register -while (DMA command register & 1) - ; +PCI address ``addr``: -0x40000 -> DMA source address -addr+100 -> DMA destination address -100 -> DMA transfer count -3 -> DMA command register -while (DMA command register & 1) - ; +:: + + addr -> DMA source address + 0x40000 -> DMA destination address + 100 -> DMA transfer count + 1 -> DMA command register + while (DMA command register & 1) + ; + +:: + + 0x40000 -> DMA source address + addr+100 -> DMA destination address + 100 -> DMA transfer count + 3 -> DMA command register + while (DMA command register & 1) + ; diff --git a/docs/specs/index.rst b/docs/specs/index.rst index d23efbe2480..30a0cf3d47e 100644 --- a/docs/specs/index.rst +++ b/docs/specs/index.rst @@ -25,3 +25,4 @@ guest hardware that is specific to QEMU. sev-guest-firmware fw_cfg vmw_pvscsi-spec + edu From patchwork Thu Nov 2 17:38:12 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 740462 Delivered-To: patch@linaro.org Received: by 2002:a5d:538f:0:b0:32d:baff:b0ca with SMTP id d15csp962266wrv; Thu, 2 Nov 2023 10:41:38 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHfZbx+YOe2IVVu0gT0/rrm1yjBoZRXvwQR/vDZc47cSw89ORXfNB7IiqiU5wk4uTedYQkx X-Received: by 2002:a1c:4c10:0:b0:405:3955:5872 with SMTP id z16-20020a1c4c10000000b0040539555872mr16913483wmf.18.1698946898786; Thu, 02 Nov 2023 10:41:38 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1698946898; cv=none; d=google.com; s=arc-20160816; b=tYt017Uw1daY1l7jc6kSF460s4F7Ipg2LmdxlRStQqacIap28XaaG6H9svREyNeyoW BgeKx7KEmn88aNnSwKiKUZPOrWQVLW/znSfGWrlbGCBCkdNAiGNRY/7JBNeNFYVi0fVm yyWFmqUyVApvM0VSVQVCiHpWVjJkv03B9rQifLYtLudS7vtByLLPCHkY7DTgPQ84kGqu sBQakRLl65AzGhJ+1x7MYPaCUhxGonLIpF8EXNYse28P99kEWe7LVEeLJFj/tfNcvI7Q EBTjQ1aH5dDmEkkmh7O1MBcydLwziFritBl4++vaExXl2/s1skFhmlppydz9H+1miJ49 Uqzw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:to:from :dkim-signature; bh=aAmwaZNtOH8AIV/DW/ygJqJkEO7JRdKRbd+n00OE3V8=; fh=PnYt+qEB9tAfMKoqBm2xjKOFpYyFFGPudh5cVIoieJM=; b=wSQJHggC5NmJ+EtGwah94wi2c6pke6iJldaXy49CuCRQ9RdZu/U13kRp7Su3GbZ14a 8K0M64E+7RJgcCWHMenwkKD3TdBq3qhK2gvoInyl8DptHya9JALkyOhkeAeEfV1ooOlg rHFC8N/sQGtqfNBd8n+RFNkvwtXWOPzo13FHCI9dMlPsf1HKseLVIOv/H2Qj6HAx9T6I T5hL+K5gHTwrvhT4zp9B59oo5xDeccLTCVrvgNgSrqPFapaamE+F5ae1NPONaMEEpkf/ gHhShWTdXzddfzKJLsHeYpWwX4XNiWCW0SwaqgFWlGkSdIjo6oqUs8c1O0hOr3D6kW5U /YLQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="WqaB/LXL"; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id t20-20020a05600c199400b004074c52b8bcsi108585wmq.94.2023.11.02.10.41.38 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Thu, 02 Nov 2023 10:41:38 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="WqaB/LXL"; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qybeq-0003N4-DT; Thu, 02 Nov 2023 13:39:04 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qybec-0003Cv-2c for qemu-devel@nongnu.org; Thu, 02 Nov 2023 13:38:50 -0400 Received: from mail-wm1-x32a.google.com ([2a00:1450:4864:20::32a]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qybeY-0002iv-BI for qemu-devel@nongnu.org; Thu, 02 Nov 2023 13:38:49 -0400 Received: by mail-wm1-x32a.google.com with SMTP id 5b1f17b1804b1-4084e49a5e5so10614305e9.3 for ; Thu, 02 Nov 2023 10:38:44 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1698946723; x=1699551523; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:from:to:cc:subject:date:message-id :reply-to; bh=aAmwaZNtOH8AIV/DW/ygJqJkEO7JRdKRbd+n00OE3V8=; b=WqaB/LXLGLyqNjEHK+vvY3BNZa1q+pfZkdU8HumCad1l+Y0Aq6kw8mr0rJL2Ddb0Jx Rd4s9di+rx04xFhZ0TrtNyBBlY9xZnDlup4vVXJnf7iCLHB63DN8IKp9/WeYaVqkTN/U vi91phuxsZ96HwgWEjoWvizwvT6a/gvBFtV0dZg1d1EQHAP9YTlk8K1rU2f27SlzNvSv F/nkJC3bn4RfM9R2NZssBjIgQqoJaxJBbge0sTLwDdvP/+xpAOQ5QkT+f2k16k6Gkj4/ flbZahJAdQ7KEGawtHmvxeB/9yDVF8+hVTuPZug/TECsuzwEsSdCH+2QxzCh5XEWYK2N oN2A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1698946723; x=1699551523; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=aAmwaZNtOH8AIV/DW/ygJqJkEO7JRdKRbd+n00OE3V8=; b=UZuqtacQNm+e0UnSCQVAJl6mEfgeJN6JVtdedaCgNuJTFQ1Q9gIzUG/S50/qCs1pJJ NvEMU7h310zA2i8Fjf3Sb6od9z9crfU8lr0OkUYVrCl3YfaD9WvVL9BwjUx0Q0EEkK6G xzref6qBTzDvpSnIqX1pqGOtXUqFBNgIu7UDAMM1kS0ADz1sYMmMutRrZ5bsHvseVXUo Qs+4DCA9zOmRlkO/lW23jwInjRPwgQcZJZ7oAkE1L4lGoqId1k/jV1TyuaD+JzZZqqpT 4YNsX9MzqNhMTAtiPBLDmSqJjvuFEmT8eCpgQqv6YZJLciFrGByjIBZwb2ncKLksrXjZ AwIA== X-Gm-Message-State: AOJu0YylIC5Tu2jnIH4djSChp4IvdFsZE+AxXRPezcDTuzq9ZXtulBAs lRXiav2gZ3TQQLaDuilrvo0Tn+cHohiW1guG2Jw= X-Received: by 2002:adf:f946:0:b0:319:8a66:f695 with SMTP id q6-20020adff946000000b003198a66f695mr13010026wrr.55.1698946723142; Thu, 02 Nov 2023 10:38:43 -0700 (PDT) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [2001:8b0:1d0::2]) by smtp.gmail.com with ESMTPSA id e16-20020adff350000000b003258934a4bcsm3046805wrp.42.2023.11.02.10.38.41 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 02 Nov 2023 10:38:41 -0700 (PDT) From: Peter Maydell To: qemu-devel@nongnu.org Subject: [PULL 10/33] docs/specs/ivshmem-spec: Convert to rST Date: Thu, 2 Nov 2023 17:38:12 +0000 Message-Id: <20231102173835.609985-11-peter.maydell@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231102173835.609985-1-peter.maydell@linaro.org> References: <20231102173835.609985-1-peter.maydell@linaro.org> MIME-Version: 1.0 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, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org Convert docs/specs/ivshmem-spec.txt to rST format. In converting, I have dropped the sections on the device's command line interface and usage, as they are already covered by the user-facing docs in system/devices/ivshmem.rst. I have also removed the reference to Memnic, because the URL is dead and a web search suggests that whatever this was it's pretty much sunk without trace. Signed-off-by: Peter Maydell Message-id: 20230927151205.70930-4-peter.maydell@linaro.org Reviewed-by: Philippe Mathieu-Daudé --- docs/specs/index.rst | 1 + .../{ivshmem-spec.txt => ivshmem-spec.rst} | 63 +++++++------------ docs/specs/pci-ids.rst | 2 +- docs/system/devices/ivshmem.rst | 2 +- 4 files changed, 26 insertions(+), 42 deletions(-) rename docs/specs/{ivshmem-spec.txt => ivshmem-spec.rst} (88%) diff --git a/docs/specs/index.rst b/docs/specs/index.rst index 30a0cf3d47e..e60c8377541 100644 --- a/docs/specs/index.rst +++ b/docs/specs/index.rst @@ -26,3 +26,4 @@ guest hardware that is specific to QEMU. fw_cfg vmw_pvscsi-spec edu + ivshmem-spec diff --git a/docs/specs/ivshmem-spec.txt b/docs/specs/ivshmem-spec.rst similarity index 88% rename from docs/specs/ivshmem-spec.txt rename to docs/specs/ivshmem-spec.rst index 1beb3a01ec3..2d8e80055b0 100644 --- a/docs/specs/ivshmem-spec.txt +++ b/docs/specs/ivshmem-spec.rst @@ -1,4 +1,6 @@ -= Device Specification for Inter-VM shared memory device = +====================================================== +Device Specification for Inter-VM shared memory device +====================================================== The Inter-VM shared memory device (ivshmem) is designed to share a memory region between multiple QEMU processes running different guests @@ -12,42 +14,17 @@ can obtain one from an ivshmem server. In the latter case, the device can additionally interrupt its peers, and get interrupted by its peers. +For information on configuring the ivshmem device on the QEMU +command line, see :doc:`../system/devices/ivshmem`. -== Configuring the ivshmem PCI device == - -There are two basic configurations: - -- Just shared memory: - - -device ivshmem-plain,memdev=HMB,... - - This uses host memory backend HMB. It should have option "share" - set. - -- Shared memory plus interrupts: - - -device ivshmem-doorbell,chardev=CHR,vectors=N,... - - An ivshmem server must already be running on the host. The device - connects to the server's UNIX domain socket via character device - CHR. - - Each peer gets assigned a unique ID by the server. IDs must be - between 0 and 65535. - - Interrupts are message-signaled (MSI-X). vectors=N configures the - number of vectors to use. - -For more details on ivshmem device properties, see the QEMU Emulator -user documentation. - - -== The ivshmem PCI device's guest interface == +The ivshmem PCI device's guest interface +======================================== The device has vendor ID 1af4, device ID 1110, revision 1. Before QEMU 2.6.0, it had revision 0. -=== PCI BARs === +PCI BARs +-------- The ivshmem PCI device has two or three BARs: @@ -59,8 +36,7 @@ There are two ways to use this device: - If you only need the shared memory part, BAR2 suffices. This way, you have access to the shared memory in the guest and can use it as - you see fit. Memnic, for example, uses ivshmem this way from guest - user space (see http://dpdk.org/browse/memnic). + you see fit. - If you additionally need the capability for peers to interrupt each other, you need BAR0 and BAR1. You will most likely want to write a @@ -77,10 +53,13 @@ accessing BAR2. Revision 0 of the device is not capable to tell guest software whether it is configured for interrupts. -=== PCI device registers === +PCI device registers +-------------------- BAR 0 contains the following registers: +:: + Offset Size Access On reset Function 0 4 read/write 0 Interrupt Mask bit 0: peer interrupt (rev 0) @@ -145,18 +124,20 @@ With multiple MSI-X vectors, different vectors can be used to indicate different events have occurred. The semantics of interrupt vectors are left to the application. - -== Interrupt infrastructure == +Interrupt infrastructure +======================== When configured for interrupts, the peers share eventfd objects in addition to shared memory. The shared resources are managed by an ivshmem server. -=== The ivshmem server === +The ivshmem server +------------------ The server listens on a UNIX domain socket. For each new client that connects to the server, the server + - picks an ID, - creates eventfd file descriptors for the interrupt vectors, - sends the ID and the file descriptor for the shared memory to the @@ -189,7 +170,8 @@ vectors. A standalone client is in contrib/ivshmem-client/. It can be useful for debugging. -=== The ivshmem Client-Server Protocol === +The ivshmem Client-Server Protocol +---------------------------------- An ivshmem device configured for interrupts connects to an ivshmem server. This section details the protocol between the two. @@ -245,7 +227,8 @@ Known bugs: * The protocol is poorly designed. -=== The ivshmem Client-Client Protocol === +The ivshmem Client-Client Protocol +---------------------------------- An ivshmem device configured for interrupts receives eventfd file descriptors for interrupting peers and getting interrupted by peers diff --git a/docs/specs/pci-ids.rst b/docs/specs/pci-ids.rst index d6707fa069a..c0a3dec2e7a 100644 --- a/docs/specs/pci-ids.rst +++ b/docs/specs/pci-ids.rst @@ -50,7 +50,7 @@ maintained as part of the virtio specification. by QEMU. 1af4:1110 - ivshmem device (shared memory, ``docs/specs/ivshmem-spec.txt``) + ivshmem device (:doc:`ivshmem-spec`) All other device IDs are reserved. diff --git a/docs/system/devices/ivshmem.rst b/docs/system/devices/ivshmem.rst index e7aaf34c200..ce71e256630 100644 --- a/docs/system/devices/ivshmem.rst +++ b/docs/system/devices/ivshmem.rst @@ -33,7 +33,7 @@ syntax when using the shared memory server is: When using the server, the guest will be assigned a VM ID (>=0) that allows guests using the same server to communicate via interrupts. Guests can read their VM ID from a device register (see -ivshmem-spec.txt). +:doc:`../../specs/ivshmem-spec`). Migration with ivshmem ~~~~~~~~~~~~~~~~~~~~~~ From patchwork Thu Nov 2 17:38:13 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 740472 Delivered-To: patch@linaro.org Received: by 2002:a5d:538f:0:b0:32d:baff:b0ca with SMTP id d15csp962726wrv; Thu, 2 Nov 2023 10:42:46 -0700 (PDT) X-Google-Smtp-Source: AGHT+IEuFIZE7ed95gjUFoFAhq+wVfazdFTT28myehESqxlYDj2P1pPBTpxFp/WLnqnZoXKm4UUk X-Received: by 2002:a05:600c:1546:b0:3fe:4cbc:c345 with SMTP id f6-20020a05600c154600b003fe4cbcc345mr16718132wmg.41.1698946966406; Thu, 02 Nov 2023 10:42:46 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1698946966; cv=none; d=google.com; s=arc-20160816; b=q9lD28ELtc98zOe5gRcVnSyKSsjoIH/SG1uEMcvhZh+gcNtT7dzt+43rFDXKL3mZNm JKJWJzUEi5iadvcuIqiNUHAFdSmUau8Co9oqM7EZIGjkbhL1OSVx91dI7mp2DxFBi90Z 5bCU0yu2fjJHrmedYLw2FYF1UolfhRlEY7N3Ipx95QSansp+LLIlOQjF7F483F2qGo+f LcGj/gP7vwBzseuV8kmVGN8arqJYK6/IvX33DQDNzhoTO0CeKLtV9nXB3wn7zGsME0Zf p7QW/BiXEbzNzQ5o5VQkpDHD/xeMB625d1ZygXGMk6Mr4EGvc39ffVnN7pRdK8ipxRnC qB7Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:to:from :dkim-signature; bh=7iUHUmJJKAYyf7dSrae5mE6BmOIBdjnU8UyawGJu76k=; fh=PnYt+qEB9tAfMKoqBm2xjKOFpYyFFGPudh5cVIoieJM=; b=CgHEjfGBbmNXIn8l0h9keBV4fVy09hBgCUggGIffaU8gZLXS7rs5jicsB681ObKmre LcocQ3PSjDm2dyUXY1r8zxpxSeHntfJBgb0yJafX40xczkoe3s4rVw4HblFvjs6yCXIV bg5lkk/M4Ngcc90UnpJ/q4YNEv61tD+z7zPi6p6Hgpix0OgnROjDTNJnWXmvMgdyx6Op eK1EdNnN6eRx5baWVOSZXO++MShFj9b7X4Jg9q0fikU+g8bdv0Rni53B/O+a0RgqEr+P x/MCXdAgxo5ANQoOtqbBuNK/hBPrHp5PA9B39fs0csZqgjhgWAM0fMkIr6iuPHw8fiuG k5hg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=b6IgFwim; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id b12-20020adff24c000000b0032d885f3f92si1815205wrp.685.2023.11.02.10.42.46 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Thu, 02 Nov 2023 10:42:46 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=b6IgFwim; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qybes-0003NE-IQ; Thu, 02 Nov 2023 13:39:06 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qybed-0003F9-T4 for qemu-devel@nongnu.org; Thu, 02 Nov 2023 13:38:52 -0400 Received: from mail-lf1-x129.google.com ([2a00:1450:4864:20::129]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qybeY-0002j0-P5 for qemu-devel@nongnu.org; Thu, 02 Nov 2023 13:38:50 -0400 Received: by mail-lf1-x129.google.com with SMTP id 2adb3069b0e04-507975d34e8so1634345e87.1 for ; Thu, 02 Nov 2023 10:38:44 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1698946723; x=1699551523; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:from:to:cc:subject:date:message-id :reply-to; bh=7iUHUmJJKAYyf7dSrae5mE6BmOIBdjnU8UyawGJu76k=; b=b6IgFwim77gxDwmemgwqAyXwuw0nD7or43/xpvrRD62uD8AY0LtIs/aKb5oAmiv7G4 z1gst9wPUzYFNSJ93BtbquqFwdhTNCnJPGykfSen57D2wK16HTNyCukOtSDwru6Eg2po 93oD07OhxwDkD56UvNehzXDCKWRenAQ7Xm8ICREe6xFhpDAlRZ/NFf3m2bcpt/E1Tnx2 K3RH4t7i1cYvEZfavKe4WKt45tvDhfQE9HW5IwjUu+Zm9jnUtk0GjytT07imqC7gzsTH E5rFRWLJJqX79TcAcDXHZTLf3GR/U966YxZHComMSm8Em2f/Tez4KDflxmdjDhIDNBe/ Uqog== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1698946723; x=1699551523; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=7iUHUmJJKAYyf7dSrae5mE6BmOIBdjnU8UyawGJu76k=; b=ehlGqNYtou8EsC58JeN5+QdOQTxZ7EdAHK9bcw0RLSjbkCxBcwwNsQfNOC3cy6V01d xaIiUF5f86VrrMmzyDqBcsgE1LsclybWvnCyeVYl2r9Q3kgx3Hs2EG2ZiRQ6dQ79o97D I4RpJX2Co4tOvdQPlIayCa1WYnoWRH8ui3U6TCONcesoFGIOIxoEXHEQh6z3DzHdxGEO CfhPN8S54iS2qhRKB+52LWZtpNKmOehpJFQksRnstyFNGz+PjbdW6lkF6FMSU/1pfObH TH2Y+kW5PGEMDxVIf0FlvnHy8nNvaubipZJiFQe4LX9V63a53xglSd9HMMyovMPDiHgm Ablw== X-Gm-Message-State: AOJu0YxmksLr2dT0wx9doP+p8/qoIUkMOwQ7nlK9V8GVZ4UC4Ij98iuz O5UIDrTzgqOuGgB5fNUJ4iUub7uagMEqVfcNszE= X-Received: by 2002:ac2:4850:0:b0:507:a089:caf4 with SMTP id 16-20020ac24850000000b00507a089caf4mr14651370lfy.60.1698946723592; Thu, 02 Nov 2023 10:38:43 -0700 (PDT) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [2001:8b0:1d0::2]) by smtp.gmail.com with ESMTPSA id e16-20020adff350000000b003258934a4bcsm3046805wrp.42.2023.11.02.10.38.43 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 02 Nov 2023 10:38:43 -0700 (PDT) From: Peter Maydell To: qemu-devel@nongnu.org Subject: [PULL 11/33] docs/specs/pvpanic: Convert to rST Date: Thu, 2 Nov 2023 17:38:13 +0000 Message-Id: <20231102173835.609985-12-peter.maydell@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231102173835.609985-1-peter.maydell@linaro.org> References: <20231102173835.609985-1-peter.maydell@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::129; envelope-from=peter.maydell@linaro.org; helo=mail-lf1-x129.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, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org Convert docs/specs/pvpanic.txt to rST format. Signed-off-by: Peter Maydell Message-id: 20230927151205.70930-5-peter.maydell@linaro.org Reviewed-by: Philippe Mathieu-Daudé --- docs/specs/index.rst | 1 + docs/specs/{pvpanic.txt => pvpanic.rst} | 41 ++++++++++++++++--------- 2 files changed, 28 insertions(+), 14 deletions(-) rename docs/specs/{pvpanic.txt => pvpanic.rst} (64%) diff --git a/docs/specs/index.rst b/docs/specs/index.rst index e60c8377541..52bfab2f68b 100644 --- a/docs/specs/index.rst +++ b/docs/specs/index.rst @@ -27,3 +27,4 @@ guest hardware that is specific to QEMU. vmw_pvscsi-spec edu ivshmem-spec + pvpanic diff --git a/docs/specs/pvpanic.txt b/docs/specs/pvpanic.rst similarity index 64% rename from docs/specs/pvpanic.txt rename to docs/specs/pvpanic.rst index 8afcde11cc8..f894bc19555 100644 --- a/docs/specs/pvpanic.txt +++ b/docs/specs/pvpanic.rst @@ -21,18 +21,21 @@ recognize. On write, the bits not recognized by the device are ignored. Software should set only bits both itself and the device recognize. Bit Definition --------------- -bit 0: a guest panic has happened and should be processed by the host -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. +~~~~~~~~~~~~~~ + +bit 0 + a guest panic has happened and should be processed by the host +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. PCI Interface ------------- The PCI interface is similar to the ISA interface except that it uses an MMIO 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 +can enable a pvpanic device by adding ``-device pvpanic-pci`` to the command line. ACPI Interface @@ -40,15 +43,25 @@ ACPI Interface pvpanic device is defined with ACPI ID "QEMU0001". Custom methods: -RDPT: To determine whether guest panic notification is supported. -Arguments: None -Return: Returns a byte, with the same semantics as the I/O port - interface. +RDPT +~~~~ -WRPT: To send a guest panic event -Arguments: Arg0 is a byte to be written, with the same semantics as - the I/O interface. -Return: None +To determine whether guest panic notification is supported. + +Arguments + None +Return + Returns a byte, with the same semantics as the I/O port interface. + +WRPT +~~~~ + +To send a guest panic event. + +Arguments + Arg0 is a byte to be written, with the same semantics as the I/O interface. +Return + None The ACPI device will automatically refer to the right port in case it is modified. From patchwork Thu Nov 2 17:38:14 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 740452 Delivered-To: patch@linaro.org Received: by 2002:a5d:538f:0:b0:32d:baff:b0ca with SMTP id d15csp961793wrv; Thu, 2 Nov 2023 10:40:35 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGthZKPlGRM0RD2/Zv+TFGz7nIdSGFVqt7HHWhAnNLelyiKVZt50JSPGYpeCdeZxJnuhRyT X-Received: by 2002:a05:6214:508f:b0:671:3f49:c8b2 with SMTP id kk15-20020a056214508f00b006713f49c8b2mr15836988qvb.15.1698946834947; Thu, 02 Nov 2023 10:40:34 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1698946834; cv=none; d=google.com; s=arc-20160816; b=YIIDDckAir4XDKiuKuUIYXG3iDYis7LTlHhqH2sFfzZAjB0YM5/Z2X3lXSHBIcJheC AEu3v3HB1dlbgOfrhx6OmnK9UbtgYVLOWdlySKVdIK2xv5qhCSdB47N9BAW1WwJAVZtK /qkJ79XHr8JDgH9eOqt1nAVa7IiGUmTjd6RgSwon4auYbI1Oo5nkIdlMNyqICJHHwJRs osYDdVplFYSDxfwJue9ESTWw0zIzYRhgK2kqRoWY/QXRC7KHEplJ5gkL2YQIq25sXmT9 rYkqvm956zyJenyqwn6VehW/p3Nb5FUKwa1WZBu4q05G9dn8U+FEltIkOytvqr94rH36 jdzg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:to:from :dkim-signature; bh=4k4TxZbAoPDPMNV3xOemPSGaAx8PeWmBzwgO2tihRic=; fh=PnYt+qEB9tAfMKoqBm2xjKOFpYyFFGPudh5cVIoieJM=; b=nBPK89D/jFnbCqLXT3wYNKPVOc8JJzpc9Cyzysa/mjcbTHdLuIc1B5GobzKUEhsuk6 T98IuYaNcRXgK0/Y36PtrNFa1uX+QKK6VWxDVND7feOrcwB4fAf9NJHcuJH07TvlGnRH srfZpK15rf/cZUfMefKUt3zNXMsEdRJ6EzAHYmb4tZ2NkRjAGmx+7nZruuUoRfQTErvs UrQW0Iaadw34wtK0RQ81wX7zJcj0HpfR9OxkpKFx3bsLAkClrP8Np7xf+L8GF9gdNEGW k9EpqoI8U6qczywoHulWWSH8Z4pJGsz1S/KuammNBtRa+WyuO/LvuAuTUrmTXsLUUSMb mHDQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="r6B/6sWv"; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id g4-20020ac87d04000000b0040538e3e2e4si290784qtb.266.2023.11.02.10.40.34 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Thu, 02 Nov 2023 10:40:34 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="r6B/6sWv"; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qybfK-0003Yp-9c; Thu, 02 Nov 2023 13:39:34 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qybed-0003Ey-NV for qemu-devel@nongnu.org; Thu, 02 Nov 2023 13:38:51 -0400 Received: from mail-wr1-x42c.google.com ([2a00:1450:4864:20::42c]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qybeY-0002jM-Qf for qemu-devel@nongnu.org; Thu, 02 Nov 2023 13:38:51 -0400 Received: by mail-wr1-x42c.google.com with SMTP id ffacd0b85a97d-32dc918d454so692487f8f.2 for ; Thu, 02 Nov 2023 10:38:45 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1698946724; x=1699551524; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:from:to:cc:subject:date:message-id :reply-to; bh=4k4TxZbAoPDPMNV3xOemPSGaAx8PeWmBzwgO2tihRic=; b=r6B/6sWvxHqQAG4uwXJpxYxb4QiPFFJcILbS8VhNLK4wscRyy8UgoR/9wX9x7yU5N8 /hf2Hxqr2g8ZyIA2rbCAdllJDI+Xa5VIfvH5gE7/Jzs4/2jGtJqXZI5AAYrzQMMpTaoa r9emrZSyKHR55+CAzSH4vaNs5ka+ZBe2c3EijHBgPjeU6cVd1mWN1Lb5EZ0xtIHbR8gX ohqO6Iwcu9M9+c/lbNHavuLEqaHNa2cTwhhRXB0o5Klj8tUj3ueLxD1gEcZjx/yMDFHb 8fz/6PygwSA0K6HPE4UZIJ6QVKWK7OC2mYWNv/cEQ4UAi2uutpPzEsnTfcj8lnhTT1S/ 4FOw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1698946724; x=1699551524; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=4k4TxZbAoPDPMNV3xOemPSGaAx8PeWmBzwgO2tihRic=; b=utQwtWAkM90GILpf5MQoyL1Lh108yLPPZTVS5XJkDJszvLNCIuExS7HMZkg09xR/GB EQeHQu898OMFsXWaql3XkRNu1sB1dhEFITFSqVfLZ3nJhsndGK22KbhGp8TH8ubExcJ1 CUnqWtW+tYN4jRkxdlGbTk2/2F/SdzARJxq6P6R+H4OvZnHSH7oWCLOjpua6P10hWdvd GbPS+r5TEATyHXgU8eZZHREiRGe4amx0LAKuJM3Zhhlge7Vd9OcpGGoqs1D5rdzEmpNy ghswR+8bFYIP77xPCQbjXGDNkf+xOqvzEjqEY0UvfDSIRjq5CHOUfuFCKnjjBmsO0RNy fTkQ== X-Gm-Message-State: AOJu0Yz7iD2k2oHYGz6Cakc923cZ5ufrDJ9eIhrgGClPXLwPsfJv2+FX 4xSBk2mAnsAt9ursF71v4YfUPoPog7k4JHoErj8= X-Received: by 2002:a5d:508c:0:b0:32f:abf9:712b with SMTP id a12-20020a5d508c000000b0032fabf9712bmr1782361wrt.46.1698946724407; Thu, 02 Nov 2023 10:38:44 -0700 (PDT) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [2001:8b0:1d0::2]) by smtp.gmail.com with ESMTPSA id e16-20020adff350000000b003258934a4bcsm3046805wrp.42.2023.11.02.10.38.43 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 02 Nov 2023 10:38:44 -0700 (PDT) From: Peter Maydell To: qemu-devel@nongnu.org Subject: [PULL 12/33] docs/specs/standard-vga: Convert to rST Date: Thu, 2 Nov 2023 17:38:14 +0000 Message-Id: <20231102173835.609985-13-peter.maydell@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231102173835.609985-1-peter.maydell@linaro.org> References: <20231102173835.609985-1-peter.maydell@linaro.org> MIME-Version: 1.0 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, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org Convert docs/specs/standard-vga.txt to rST format. Signed-off-by: Peter Maydell Message-id: 20230927151205.70930-6-peter.maydell@linaro.org Reviewed-by: Philippe Mathieu-Daudé --- MAINTAINERS | 1 + docs/specs/index.rst | 1 + docs/specs/standard-vga.rst | 94 +++++++++++++++++++++++++++++++++++++ docs/specs/standard-vga.txt | 81 -------------------------------- hw/display/vga-isa.c | 2 +- hw/display/vga-pci.c | 2 +- 6 files changed, 98 insertions(+), 83 deletions(-) create mode 100644 docs/specs/standard-vga.rst delete mode 100644 docs/specs/standard-vga.txt diff --git a/MAINTAINERS b/MAINTAINERS index 8e10bd085ff..b5e1765d7a6 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -2468,6 +2468,7 @@ F: hw/display/vga* F: hw/display/bochs-display.c F: include/hw/display/vga.h F: include/hw/display/bochs-vbe.h +F: docs/specs/standard-vga.rst ramfb M: Gerd Hoffmann diff --git a/docs/specs/index.rst b/docs/specs/index.rst index 52bfab2f68b..ee84b8109d6 100644 --- a/docs/specs/index.rst +++ b/docs/specs/index.rst @@ -28,3 +28,4 @@ guest hardware that is specific to QEMU. edu ivshmem-spec pvpanic + standard-vga diff --git a/docs/specs/standard-vga.rst b/docs/specs/standard-vga.rst new file mode 100644 index 00000000000..992f429ced1 --- /dev/null +++ b/docs/specs/standard-vga.rst @@ -0,0 +1,94 @@ + +QEMU Standard VGA +================= + +Exists in two variants, for isa and pci. + +command line switches: + +``-vga std`` + picks isa for -M isapc, otherwise pci +``-device VGA`` + pci variant +``-device isa-vga`` + isa variant +``-device secondary-vga`` + legacy-free pci variant + + +PCI spec +-------- + +Applies to the pci variant only for obvious reasons. + +PCI ID + ``1234:1111`` + +PCI Region 0 + Framebuffer memory, 16 MB in size (by default). + Size is tunable via vga_mem_mb property. + +PCI Region 1 + Reserved (so we have the option to make the framebuffer bar 64bit). + +PCI Region 2 + MMIO bar, 4096 bytes in size (QEMU 1.3+) + +PCI ROM Region + Holds the vgabios (QEMU 0.14+). + + +The legacy-free variant has no ROM and has ``PCI_CLASS_DISPLAY_OTHER`` +instead of ``PCI_CLASS_DISPLAY_VGA``. + + +IO ports used +------------- + +Doesn't apply to the legacy-free pci variant, use the MMIO bar instead. + +``03c0 - 03df`` + standard vga ports +``01ce`` + bochs vbe interface index port +``01cf`` + bochs vbe interface data port (x86 only) +``01d0`` + bochs vbe interface data port + + +Memory regions used +------------------- + +``0xe0000000`` + Framebuffer memory, isa variant only. + +The pci variant used to mirror the framebuffer bar here, QEMU 0.14+ +stops doing that (except when in ``-M pc-$old`` compat mode). + + +MMIO area spec +-------------- + +Likewise applies to the pci variant only for obvious reasons. + +``0000 - 03ff`` + edid data blob. +``0400 - 041f`` + vga ioports (``0x3c0`` to ``0x3df``), remapped 1:1. Word access + is supported, bytes are written in little endian order (aka index + port first), so indexed registers can be updated with a single + mmio write (and thus only one vmexit). +``0500 - 0515`` + bochs dispi interface registers, mapped flat without index/data ports. + Use ``(index << 1)`` as offset for (16bit) register access. +``0600 - 0607`` + QEMU extended registers. QEMU 2.2+ only. + The pci revision is 2 (or greater) when these registers are present. + The registers are 32bit. +``0600`` + QEMU extended register region size, in bytes. +``0604`` + framebuffer endianness register. + - ``0xbebebebe`` indicates big endian. + - ``0x1e1e1e1e`` indicates little endian. diff --git a/docs/specs/standard-vga.txt b/docs/specs/standard-vga.txt deleted file mode 100644 index 18f75f1b302..00000000000 --- a/docs/specs/standard-vga.txt +++ /dev/null @@ -1,81 +0,0 @@ - -QEMU Standard VGA -================= - -Exists in two variants, for isa and pci. - -command line switches: - -vga std [ picks isa for -M isapc, otherwise pci ] - -device VGA [ pci variant ] - -device isa-vga [ isa variant ] - -device secondary-vga [ legacy-free pci variant ] - - -PCI spec --------- - -Applies to the pci variant only for obvious reasons. - -PCI ID: 1234:1111 - -PCI Region 0: - Framebuffer memory, 16 MB in size (by default). - Size is tunable via vga_mem_mb property. - -PCI Region 1: - Reserved (so we have the option to make the framebuffer bar 64bit). - -PCI Region 2: - MMIO bar, 4096 bytes in size (qemu 1.3+) - -PCI ROM Region: - Holds the vgabios (qemu 0.14+). - - -The legacy-free variant has no ROM and has PCI_CLASS_DISPLAY_OTHER -instead of PCI_CLASS_DISPLAY_VGA. - - -IO ports used -------------- - -Doesn't apply to the legacy-free pci variant, use the MMIO bar instead. - -03c0 - 03df : standard vga ports -01ce : bochs vbe interface index port -01cf : bochs vbe interface data port (x86 only) -01d0 : bochs vbe interface data port - - -Memory regions used -------------------- - -0xe0000000 : Framebuffer memory, isa variant only. - -The pci variant used to mirror the framebuffer bar here, qemu 0.14+ -stops doing that (except when in -M pc-$old compat mode). - - -MMIO area spec --------------- - -Likewise applies to the pci variant only for obvious reasons. - -0000 - 03ff : edid data blob. -0400 - 041f : vga ioports (0x3c0 -> 0x3df), remapped 1:1. - word access is supported, bytes are written - in little endia order (aka index port first), - so indexed registers can be updated with a - single mmio write (and thus only one vmexit). -0500 - 0515 : bochs dispi interface registers, mapped flat - without index/data ports. Use (index << 1) - as offset for (16bit) register access. - -0600 - 0607 : qemu extended registers. qemu 2.2+ only. - The pci revision is 2 (or greater) when - these registers are present. The registers - are 32bit. - 0600 : qemu extended register region size, in bytes. - 0604 : framebuffer endianness register. - - 0xbebebebe indicates big endian. - - 0x1e1e1e1e indicates little endian. diff --git a/hw/display/vga-isa.c b/hw/display/vga-isa.c index 2a5437d8037..c096ec93e52 100644 --- a/hw/display/vga-isa.c +++ b/hw/display/vga-isa.c @@ -1,7 +1,7 @@ /* * QEMU ISA VGA Emulator. * - * see docs/specs/standard-vga.txt for virtual hardware specs. + * see docs/specs/standard-vga.rst for virtual hardware specs. * * Copyright (c) 2003 Fabrice Bellard * diff --git a/hw/display/vga-pci.c b/hw/display/vga-pci.c index b351b8f299d..e4f45b4476d 100644 --- a/hw/display/vga-pci.c +++ b/hw/display/vga-pci.c @@ -1,7 +1,7 @@ /* * QEMU PCI VGA Emulator. * - * see docs/specs/standard-vga.txt for virtual hardware specs. + * see docs/specs/standard-vga.rst for virtual hardware specs. * * Copyright (c) 2003 Fabrice Bellard * From patchwork Thu Nov 2 17:38:15 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 740449 Delivered-To: patch@linaro.org Received: by 2002:a5d:538f:0:b0:32d:baff:b0ca with SMTP id d15csp961614wrv; Thu, 2 Nov 2023 10:40:10 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFw2FXWNEFn941nWGSFFGzdQf8EvzpYYZCwGP4WVDb4H3k+TUsZqW3Ez3gwkdGlyJXpKEVX X-Received: by 2002:a05:6870:1083:b0:1ea:4a3c:a597 with SMTP id 3-20020a056870108300b001ea4a3ca597mr16381894oaq.33.1698946810223; Thu, 02 Nov 2023 10:40:10 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1698946810; cv=none; d=google.com; s=arc-20160816; b=au/OK985P9ecjJv12t3bczmSHcyvCVRLqD0zis022IxgeXLpp4jmCUTqcpYpObkVhr hY2MEb3enAf/kAzk9eKGAxhgdY0qoM8IDPF+gCiANrI3gT+AH1wnN+S84vxa+PwF7RVt 1fXlenCXzK1vH1mcB/eL27vnMXlLgiXF4hCbXs8m8IBZb9UB9TsmhXU3yWmg7mtAuxhC rL9i2Lo9xByDakW6OjaYzdmBIQnH5zzFN3YvanlVveL3PNVyPqDmhRu8GNA1js1seNg1 559BJqoLmsTnmfmurs0RHS/oARDqi8m9USdK9deUYBK9NezN3Bfu/HA7Z4P3BzRpDDEo 97bQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:to:from :dkim-signature; bh=LqJpZDE/iTKqMgJkXz9zHkvEVRtZ8ol0kkFTVeB0qSA=; fh=PnYt+qEB9tAfMKoqBm2xjKOFpYyFFGPudh5cVIoieJM=; b=eKnikokd/yh/bHbRelApSdDmKvPiBNGJoPR76kLiNzpVwYO5Mlxx6TYS+ZoTI/pTKs 5cuXWYHanKIYwAuoINqWaqSWJWRYLqjSG4oFEcfw+YOxTcZt6Yr93YPepQA1YoW6XdYH bBq0f0YOtjk80MsALinOruKoh67qw7tfz6knaJ2jT+fr9tbjHf0p+AII15TIVORO3BRa 7iNpKRAjmlnjFNtOHv0PWjbvEwQvps9kTBV9oy28coEyaOoT5y+LSM8kJwb7ejysdRfa 0pbVOrqj5JnrEM3w2CbIlkVD3FGnQiRsPLluul2sUcuYTVJ/QgZaecHNrP/BlpDPotxb LuSA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=Jf7gvPzJ; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id t11-20020a0cef0b000000b0067123837efdsi280592qvr.390.2023.11.02.10.40.10 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Thu, 02 Nov 2023 10:40:10 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=Jf7gvPzJ; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qybfS-0003vI-0j; Thu, 02 Nov 2023 13:39:42 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qybec-0003Cx-6p for qemu-devel@nongnu.org; Thu, 02 Nov 2023 13:38:50 -0400 Received: from mail-wm1-x330.google.com ([2a00:1450:4864:20::330]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qybeY-0002jQ-PR for qemu-devel@nongnu.org; Thu, 02 Nov 2023 13:38:49 -0400 Received: by mail-wm1-x330.google.com with SMTP id 5b1f17b1804b1-40790b0a224so9545565e9.0 for ; Thu, 02 Nov 2023 10:38:45 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1698946725; x=1699551525; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:from:to:cc:subject:date:message-id :reply-to; bh=LqJpZDE/iTKqMgJkXz9zHkvEVRtZ8ol0kkFTVeB0qSA=; b=Jf7gvPzJkiaCUGfhwAEfYBT6RGPd8n+SqNTS9k8PVJUisYVunVAnTFsi9UY16OgDsv hlzOiw7JowZlGn0U2EFFYR/TYoYcoZGUmfxWD3eiwGqWGYJBdwHg4ldHZ9Fah3MJn20C JD+2unIXRmPmeH8HOr72MczWzyv3wc3RlT3FYsfsTtDzZa3by5cXgYhiAIifp+SmiDBF eFeqgmF98pN8FMIzyFkeaTnTy2H1PxRmgl+AQbZr9FL9sLiSEHaptyN0i0CRQz4M/yJ2 QIAdStJ6+sfddWqELQywRDTzu3zlHnb+A42TxHENR5uBn9OcVxZT0GzCEig9EzXrthTI 5jYw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1698946725; x=1699551525; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=LqJpZDE/iTKqMgJkXz9zHkvEVRtZ8ol0kkFTVeB0qSA=; b=Cax4o8jKKwDYw+77QTyBi3uLoMhInhh1pfsqQGiYUHrDRd0lVV2/OigP26ENtcK/g6 Es3Q6vOhslgHes/GWWWmY1IClHDNn0P5f6sAgOeufIRtAReeuCjQLgUIb224HZsNTTFm 9aRJT2mXtZjpHfRWSX6Hn0+tRPe882CkYtV5jnPq1K2+u8kib3unMyiVr+CaEdQzdbKw MLzlpR8pxWtERBvUgAeOZu8ceKQcaUeG5YspC7HDwSof2pgOzEd5BxtbhRLq2Fzjqndx yvqQU4wQWwLm0SgcDampHKsOs4L66OMOGagIJpIv4KYx+eyq3se01+gNQy12DbwSvVnr /7tw== X-Gm-Message-State: AOJu0YwVUw3xNuLpFoWecEZ1hxlRqM+7gyMRIYBnmzDKTmj0pA1ZNZlD KMTxMMeeGEtiGtGnd0Ftw0qxlfUGqhLAo2TLKXQ= X-Received: by 2002:a05:6000:1445:b0:32f:7a07:be07 with SMTP id v5-20020a056000144500b0032f7a07be07mr15668891wrx.17.1698946724884; Thu, 02 Nov 2023 10:38:44 -0700 (PDT) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [2001:8b0:1d0::2]) by smtp.gmail.com with ESMTPSA id e16-20020adff350000000b003258934a4bcsm3046805wrp.42.2023.11.02.10.38.44 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 02 Nov 2023 10:38:44 -0700 (PDT) From: Peter Maydell To: qemu-devel@nongnu.org Subject: [PULL 13/33] docs/specs/virt-ctlr: Convert to rST Date: Thu, 2 Nov 2023 17:38:15 +0000 Message-Id: <20231102173835.609985-14-peter.maydell@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231102173835.609985-1-peter.maydell@linaro.org> References: <20231102173835.609985-1-peter.maydell@linaro.org> MIME-Version: 1.0 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, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org Convert docs/specs/virt-ctlr.txt to rST format. I added the name of the device to give readers a bit more idea of which device we're actually documenting here. Signed-off-by: Peter Maydell Message-id: 20230927151205.70930-7-peter.maydell@linaro.org Reviewed-by: Philippe Mathieu-Daudé --- MAINTAINERS | 1 + docs/specs/index.rst | 1 + docs/specs/{virt-ctlr.txt => virt-ctlr.rst} | 12 +++++------- 3 files changed, 7 insertions(+), 7 deletions(-) rename docs/specs/{virt-ctlr.txt => virt-ctlr.rst} (70%) diff --git a/MAINTAINERS b/MAINTAINERS index b5e1765d7a6..11f3bdbfa78 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -1283,6 +1283,7 @@ F: include/hw/char/goldfish_tty.h F: include/hw/intc/goldfish_pic.h F: include/hw/intc/m68k_irqc.h F: include/hw/misc/virt_ctrl.h +F: docs/specs/virt-ctlr.rst MicroBlaze Machines ------------------- diff --git a/docs/specs/index.rst b/docs/specs/index.rst index ee84b8109d6..8d30968650b 100644 --- a/docs/specs/index.rst +++ b/docs/specs/index.rst @@ -29,3 +29,4 @@ guest hardware that is specific to QEMU. ivshmem-spec pvpanic standard-vga + virt-ctlr diff --git a/docs/specs/virt-ctlr.txt b/docs/specs/virt-ctlr.rst similarity index 70% rename from docs/specs/virt-ctlr.txt rename to docs/specs/virt-ctlr.rst index 24d38084f7f..ad3edde82d2 100644 --- a/docs/specs/virt-ctlr.txt +++ b/docs/specs/virt-ctlr.rst @@ -1,9 +1,9 @@ Virtual System Controller ========================= -This device is a simple interface defined for the pure virtual machine with no -hardware reference implementation to allow the guest kernel to send command -to the host hypervisor. +The ``virt-ctrl`` device is a simple interface defined for the pure +virtual machine with no hardware reference implementation to allow the +guest kernel to send command to the host hypervisor. The specification can evolve, the current state is defined as below. @@ -11,14 +11,12 @@ This is a MMIO mapped device using 256 bytes. Two 32bit registers are defined: -1- the features register (read-only, address 0x00) - +the features register (read-only, address 0x00) This register allows the device to report features supported by the controller. The only feature supported for the moment is power control (0x01). -2- the command register (write-only, address 0x04) - +the command register (write-only, address 0x04) This register allows the kernel to send the commands to the hypervisor. The implemented commands are part of the power control feature and are reset (1), halt (2) and panic (3). From patchwork Thu Nov 2 17:38:16 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 740476 Delivered-To: patch@linaro.org Received: by 2002:a5d:538f:0:b0:32d:baff:b0ca with SMTP id d15csp964162wrv; Thu, 2 Nov 2023 10:46:13 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFxdy+oPKeJs2xVWmsuBQKlqoS7RrR1zR6PNxqY/NfXFykkCD82SfvLenVbXbK3wQAW7AqL X-Received: by 2002:a5d:518c:0:b0:32d:d756:2cd3 with SMTP id k12-20020a5d518c000000b0032dd7562cd3mr14750290wrv.22.1698947173265; Thu, 02 Nov 2023 10:46:13 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1698947173; cv=none; d=google.com; s=arc-20160816; b=h1eyJRvhxdrFceRVUw875uOaChdJQzoR6mbgg2ZAHwd2GVKM6OgqLrks4g3aXFhA7f haEU6Fkbg3oBbrL4fZ3oJZYyZe3J03PH4erZQNX7j6JZ7Of0dhBhpysYE/daGsLeh14J Y2zf9hKyd8Cyr4lQfy9V7OBBxIc5UsAysSj5ZIT0Dh5P+Z189ikQxOcpBruwyfkFneTQ LLldh40/uzF5yB1JMuspbOOnsNdyLoQ0y5N3mAU6/aYNhKl8IpDb31ebQwVJzZC8AgBZ pd+T9Hm2dgLCfu0lJDFRdF7OISPM+lyPpRjPk0eUhuYbw4L9b4dd3ELrVgqwVS2znv93 fc8A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:to:from :dkim-signature; bh=E2aA9Ap+poLvHcptWhfJUzZe/Ew9suv4NHGXesXSWP0=; fh=PnYt+qEB9tAfMKoqBm2xjKOFpYyFFGPudh5cVIoieJM=; b=y27M4iJY0Cz/TYQE11FZsogO+VyBcswWNEB/P0iFDm8wRxSXx7U8l+HJKZ4xV8M5AT xPXQKLAnEMx/WOUVYRbPflqCfN8913VEUs3pqt372cphBLkoqncSP3zlXBdqoQ7QH1/u h7oG+AWU9Rfx6Mc30o1a0bW3hLgdBDZitVAcXWEVlYpfOgwGhcGyXnTzXcvDz20rs1tC iGugNDLJ43ee9kVGbw/7y9ODRnuA+NfO+45W7zOB5kwHLZOp5AyBUstEtI5CLimLfAXm B6pt5QCd4lkP4jX3KiBTTqeictIK0kaeDh5E/kwaIOx0qQidgsQp4iH4nIJ7tkIJxeUX 9Rkg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="gKfoSO/u"; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id e6-20020a056000178600b0032d8f8c6f48si1934685wrg.273.2023.11.02.10.46.13 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Thu, 02 Nov 2023 10:46:13 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="gKfoSO/u"; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qyber-0003N5-1V; Thu, 02 Nov 2023 13:39:05 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qybed-0003Eg-FL for qemu-devel@nongnu.org; Thu, 02 Nov 2023 13:38:51 -0400 Received: from mail-wm1-x330.google.com ([2a00:1450:4864:20::330]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qybeY-0002jZ-SA for qemu-devel@nongnu.org; Thu, 02 Nov 2023 13:38:51 -0400 Received: by mail-wm1-x330.google.com with SMTP id 5b1f17b1804b1-40853c639abso8954725e9.0 for ; Thu, 02 Nov 2023 10:38:46 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1698946725; x=1699551525; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:from:to:cc:subject:date:message-id :reply-to; bh=E2aA9Ap+poLvHcptWhfJUzZe/Ew9suv4NHGXesXSWP0=; b=gKfoSO/uksXTd5U+zAGzh60uMQE72tXBl+aIzJof3UiVb3yniXwISP+c70HdFGWZfK MAWiPBWCfcAlwA3pzia5lVYJY57sLxE0z84P4AGKYTtjXMhVgCqEQcr7DLxPrurV70m7 uMV5y1v5FZi/5p0LQzlqQIfPaBcq4NGBSZZ0FRvkp5z7pPapRSxoz3GwbvdYCj28KjmJ 6LXGDLjiFyDW9x+ppKKST0Wrd5hYewOfYEjE8P4C2fykReH4DhYQkwCHXqk8/6IFWGwL L9zzRk7332DjSU/rFZmwsxSgaIGqbhoDSzConez+FOv4EI/g3UtUiNvDttg5rmNk8CbT EOZQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1698946725; x=1699551525; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=E2aA9Ap+poLvHcptWhfJUzZe/Ew9suv4NHGXesXSWP0=; b=L4/nUIohjWLIEa8GVyClXut4n03mDT4uL+o87xhN44nWvEi8WIQYr6fTe7NMPuX1XX duyZC48cyvY9/0TKMjZQVh50RGfgSFeUjTSjdyFYDoJBBuCOiYzk31JjIFyK5l+2DY4I pil+iuIEf8C+NeMnm4QKyywlPYqY4iIFLJOvv9zyGbRBb9OdWtX22h9eoqAuhENcAsPL Ke01ENNNWk8DYzB3f1TCwL1xkgVNCWU8mwdblBJio01s1PXoK9NRiY2Nk7MoBOdDRMLc a54mZxActu6fp0Fg5qGSK7vynnn/ztrP0P6RBxFu6ZmEp5edAlwyM0Nc9TDWQryTIQYq 6CZA== X-Gm-Message-State: AOJu0Yz4M9TxmpVdqaBwmho/Y2JIs6MATSnAe4Yo2yneNfRgSHC3aYGI GyTwL2ngy9qpU87GaEmo87NUlxO7sttmvNp2ynE= X-Received: by 2002:adf:f6d0:0:b0:313:eb09:c029 with SMTP id y16-20020adff6d0000000b00313eb09c029mr14404237wrp.43.1698946725356; Thu, 02 Nov 2023 10:38:45 -0700 (PDT) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [2001:8b0:1d0::2]) by smtp.gmail.com with ESMTPSA id e16-20020adff350000000b003258934a4bcsm3046805wrp.42.2023.11.02.10.38.44 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 02 Nov 2023 10:38:45 -0700 (PDT) From: Peter Maydell To: qemu-devel@nongnu.org Subject: [PULL 14/33] docs/specs/vmcoreinfo: Convert to rST Date: Thu, 2 Nov 2023 17:38:16 +0000 Message-Id: <20231102173835.609985-15-peter.maydell@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231102173835.609985-1-peter.maydell@linaro.org> References: <20231102173835.609985-1-peter.maydell@linaro.org> MIME-Version: 1.0 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, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org Convert docs/specs/vmcoreinfo.txt to rST format. Signed-off-by: Peter Maydell Message-id: 20230927151205.70930-8-peter.maydell@linaro.org Reviewed-by: Philippe Mathieu-Daudé Acked-by: Marc-André Lureau --- MAINTAINERS | 1 + docs/specs/index.rst | 1 + docs/specs/vmcoreinfo.rst | 54 +++++++++++++++++++++++++++++++++++++++ docs/specs/vmcoreinfo.txt | 53 -------------------------------------- 4 files changed, 56 insertions(+), 53 deletions(-) create mode 100644 docs/specs/vmcoreinfo.rst delete mode 100644 docs/specs/vmcoreinfo.txt diff --git a/MAINTAINERS b/MAINTAINERS index 11f3bdbfa78..6d654cc1277 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -2884,6 +2884,7 @@ F: include/sysemu/dump.h F: qapi/dump.json F: scripts/dump-guest-memory.py F: stubs/dump.c +F: docs/specs/vmcoreinfo.rst Error reporting M: Markus Armbruster diff --git a/docs/specs/index.rst b/docs/specs/index.rst index 8d30968650b..7a56ccb2155 100644 --- a/docs/specs/index.rst +++ b/docs/specs/index.rst @@ -30,3 +30,4 @@ guest hardware that is specific to QEMU. pvpanic standard-vga virt-ctlr + vmcoreinfo diff --git a/docs/specs/vmcoreinfo.rst b/docs/specs/vmcoreinfo.rst new file mode 100644 index 00000000000..6541aa116f7 --- /dev/null +++ b/docs/specs/vmcoreinfo.rst @@ -0,0 +1,54 @@ +================= +VMCoreInfo device +================= + +The ``-device vmcoreinfo`` will create a ``fw_cfg`` entry for a guest to +store dump details. + +``etc/vmcoreinfo`` +================== + +A guest may use this ``fw_cfg`` entry to add information details to QEMU +dumps. + +The entry of 16 bytes has the following layout, in little-endian:: + + #define VMCOREINFO_FORMAT_NONE 0x0 + #define VMCOREINFO_FORMAT_ELF 0x1 + + struct FWCfgVMCoreInfo { + uint16_t host_format; /* formats host supports */ + uint16_t guest_format; /* format guest supplies */ + uint32_t size; /* size of vmcoreinfo region */ + uint64_t paddr; /* physical address of vmcoreinfo region */ + }; + +Only full write (of 16 bytes) are considered valid for further +processing of entry values. + +A write of 0 in ``guest_format`` will disable further processing of +vmcoreinfo entry values & content. + +You may write a ``guest_format`` that is not supported by the host, in +which case the entry data can be ignored by QEMU (but you may still +access it through a debugger, via ``vmcoreinfo_realize::vmcoreinfo_state``). + +Format & content +================ + +As of QEMU 2.11, only ``VMCOREINFO_FORMAT_ELF`` is supported. + +The entry gives location and size of an ELF note that is appended in +qemu dumps. + +The note format/class must be of the target bitness and the size must +be less than 1Mb. + +If the ELF note name is ``VMCOREINFO``, it is expected to be the Linux +vmcoreinfo note (see `the kernel documentation for its format +`_). +In this case, qemu dump code will read the content +as a key=value text file, looking for ``NUMBER(phys_base)`` key +value. The value is expected to be more accurate than architecture +guess of the value. This is useful for KASLR-enabled guest with +ancient tools not handling the ``VMCOREINFO`` note. diff --git a/docs/specs/vmcoreinfo.txt b/docs/specs/vmcoreinfo.txt deleted file mode 100644 index bcbca6fe47c..00000000000 --- a/docs/specs/vmcoreinfo.txt +++ /dev/null @@ -1,53 +0,0 @@ -================= -VMCoreInfo device -================= - -The `-device vmcoreinfo` will create a fw_cfg entry for a guest to -store dump details. - -etc/vmcoreinfo -************** - -A guest may use this fw_cfg entry to add information details to qemu -dumps. - -The entry of 16 bytes has the following layout, in little-endian:: - -#define VMCOREINFO_FORMAT_NONE 0x0 -#define VMCOREINFO_FORMAT_ELF 0x1 - - struct FWCfgVMCoreInfo { - uint16_t host_format; /* formats host supports */ - uint16_t guest_format; /* format guest supplies */ - uint32_t size; /* size of vmcoreinfo region */ - uint64_t paddr; /* physical address of vmcoreinfo region */ - }; - -Only full write (of 16 bytes) are considered valid for further -processing of entry values. - -A write of 0 in guest_format will disable further processing of -vmcoreinfo entry values & content. - -You may write a guest_format that is not supported by the host, in -which case the entry data can be ignored by qemu (but you may still -access it through a debugger, via vmcoreinfo_realize::vmcoreinfo_state). - -Format & content -**************** - -As of qemu 2.11, only VMCOREINFO_FORMAT_ELF is supported. - -The entry gives location and size of an ELF note that is appended in -qemu dumps. - -The note format/class must be of the target bitness and the size must -be less than 1Mb. - -If the ELF note name is "VMCOREINFO", it is expected to be the Linux -vmcoreinfo note (see Documentation/ABI/testing/sysfs-kernel-vmcoreinfo -in Linux source). In this case, qemu dump code will read the content -as a key=value text file, looking for "NUMBER(phys_base)" key -value. The value is expected to be more accurate than architecture -guess of the value. This is useful for KASLR-enabled guest with -ancient tools not handling the VMCOREINFO note. From patchwork Thu Nov 2 17:38:17 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 740467 Delivered-To: patch@linaro.org Received: by 2002:a5d:538f:0:b0:32d:baff:b0ca with SMTP id d15csp962578wrv; Thu, 2 Nov 2023 10:42:25 -0700 (PDT) X-Google-Smtp-Source: AGHT+IE2AYDjyLVIOAvzn+xJyn/1RiAjZVZtWnDVqW9/sbmEuSVPaKmb2Fp8f95j5GoHxSZX1MqB X-Received: by 2002:a05:600c:3502:b0:407:8e85:899f with SMTP id h2-20020a05600c350200b004078e85899fmr16096028wmq.16.1698946945738; Thu, 02 Nov 2023 10:42:25 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1698946945; cv=none; d=google.com; s=arc-20160816; b=XRRAmFCxYXR9vTJmiYx81B/rxn/5nX2LeOlmtSW0Cp254pD3O+UaX9Nqz32CAkjTGI Xu5qAKG6E9rA6h4oYyKvpz1du0hxU7zpUvIylki63x9/xZj1T+kgzF5623FlRcbjBcno sIj9fSv36W2pKqo+buT98m8s+2MCHhVRkjOeB4rh/O3nYI5p231atpR0Do4if3r+wTTO lUrFAhgjOCiQvHQ/+UXMTNn0461jE+pUom3xj8hnWY5GCp9Ef3KlXVg4Gi1wafBCHqWj Wr25+k75YI4EE4ELPMIfUkXOkw95ArC5g1wWDYSMzo3v0z2pfuPrtM3EGK5OBl4P2/Mv te9A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:to:from :dkim-signature; bh=5xpBWX8lLUIutpUTurxJzEpPMbyD23jwWMi+2vGNS60=; fh=PnYt+qEB9tAfMKoqBm2xjKOFpYyFFGPudh5cVIoieJM=; b=jgFvqTKhRBhPDF0sMnpdkhKDoivp+dkOWNfizmVMk6o+RAcyyRB3relzvImdpfxoK1 l2jlc62ScjWSwhkDmoXxSPEw59N8zerdS2iOo51h9mwpgQMX2ZCmQRIqS894NmxMkngW vnwyG/Ntwvt2GwV46coY9Ab+T9khEB3/5/AxHjlLsPm+sV4g5LVUFN+ucwABmydDZ2eJ BIHb1BJf0gZ/aU/ivtKAoqePv6Lth4ajXTYq4jOCpjKq/JZqq3VV4GGVtqBzEGlxg/z6 pM7kIYHE5mbQ+R01y4M8tc2Bps78KvbTWxn+pFzBMag8Sbe5JYUy1XOzZ9MZCW08zc49 IWJg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=FhhHsbeU; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id n21-20020a05600c4f9500b0040751253e10si99470wmq.189.2023.11.02.10.42.25 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Thu, 02 Nov 2023 10:42:25 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=FhhHsbeU; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qybfI-0003X2-Ni; Thu, 02 Nov 2023 13:39:32 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qybeh-0003Gd-CT for qemu-devel@nongnu.org; Thu, 02 Nov 2023 13:38:55 -0400 Received: from mail-wr1-x435.google.com ([2a00:1450:4864:20::435]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qybea-0002jg-1o for qemu-devel@nongnu.org; Thu, 02 Nov 2023 13:38:54 -0400 Received: by mail-wr1-x435.google.com with SMTP id ffacd0b85a97d-32dc9ff4a8fso675569f8f.1 for ; Thu, 02 Nov 2023 10:38:47 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1698946726; x=1699551526; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:from:to:cc:subject:date:message-id :reply-to; bh=5xpBWX8lLUIutpUTurxJzEpPMbyD23jwWMi+2vGNS60=; b=FhhHsbeU0SCstI3fV2MOVjblXrjNSm+Qvi3NFeuJ3MwhR6F4E6CV7k7OvvIrI/nXG+ 2QFV0BVvMVUZMx+D67JBQkwYGJkbn9zj46ZRfsT51zSYBCqPc4yzhpJJmkSqP7NrsPgn e9FHhbgSrs9Xk1ekTP/Cvsx9B4fnw9UDzPTHchyo4ppCICrRnYmVBTB9wODeJqdJ8WIN XtghnIfk29JudWuUkeXUbupBO8XFOfCbjELU60WjF/Kfjlfvb/3S43yHUXaMq8VSV3dW zkAqUBdeVkiwseY1nzIknEpU++OAHDCmU70y1W9SEMv+6k79MWW0f55qx/A620Zq5lrf kCNQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1698946726; x=1699551526; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=5xpBWX8lLUIutpUTurxJzEpPMbyD23jwWMi+2vGNS60=; b=DzCIbPfOQTiPE6fMLz9cChBKjE4qG/oXqetE0QuezHG+xd6AfoTTd7AIn2Tx9T66th Xfxe0Ko1DAIkWuAZQTdXgqLH5H4JoDnkgqQ9hq5MyqIVc1wzKpx2MpzzhWqUPLPOP+ix UnQlcGvpfe31JMmaWA9GYbId+epsBVXNFGcEbLWmz7V8poVtBn2AjZmdIlpcrvFX9SSD EH3KckPKd7TC9zoHb9Mn+VElmCpV8M1kByaHiPrjN4VsV+LEcMFOMpCKUtSBwlOdqBLa dbA5uR6VB3G9bKVuUYQaAE1WyM49lqfKguFmV4YvL0H6w7naITr1+Z8nzn7T8J7bYpME hbTA== X-Gm-Message-State: AOJu0Yy1yejNJy/km96uKzQgjKtpsWmznOF9gIw7/AipsScczvrcNiaZ NO0Kkgb8jDdtX7SCDoqKRdWJamo4GKUQoopIDKo= X-Received: by 2002:a5d:4a4c:0:b0:32d:d2ef:b0c1 with SMTP id v12-20020a5d4a4c000000b0032dd2efb0c1mr14633953wrs.33.1698946725814; Thu, 02 Nov 2023 10:38:45 -0700 (PDT) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [2001:8b0:1d0::2]) by smtp.gmail.com with ESMTPSA id e16-20020adff350000000b003258934a4bcsm3046805wrp.42.2023.11.02.10.38.45 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 02 Nov 2023 10:38:45 -0700 (PDT) From: Peter Maydell To: qemu-devel@nongnu.org Subject: [PULL 15/33] docs/specs/vmgenid: Convert to rST Date: Thu, 2 Nov 2023 17:38:17 +0000 Message-Id: <20231102173835.609985-16-peter.maydell@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231102173835.609985-1-peter.maydell@linaro.org> References: <20231102173835.609985-1-peter.maydell@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::435; envelope-from=peter.maydell@linaro.org; helo=mail-wr1-x435.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, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org Convert docs/specs/vmgenid.txt to rST format. Reviewed-by: Ani Sinha Signed-off-by: Peter Maydell Message-id: 20230927151205.70930-9-peter.maydell@linaro.org --- MAINTAINERS | 2 +- docs/specs/index.rst | 1 + docs/specs/vmgenid.rst | 246 +++++++++++++++++++++++++++++++++++++++++ docs/specs/vmgenid.txt | 245 ---------------------------------------- 4 files changed, 248 insertions(+), 246 deletions(-) create mode 100644 docs/specs/vmgenid.rst delete mode 100644 docs/specs/vmgenid.txt diff --git a/MAINTAINERS b/MAINTAINERS index 6d654cc1277..397c3967f6b 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -2437,7 +2437,7 @@ S: Orphan R: Ani Sinha F: hw/acpi/vmgenid.c F: include/hw/acpi/vmgenid.h -F: docs/specs/vmgenid.txt +F: docs/specs/vmgenid.rst F: tests/qtest/vmgenid-test.c LED diff --git a/docs/specs/index.rst b/docs/specs/index.rst index 7a56ccb2155..b3f482b0aa5 100644 --- a/docs/specs/index.rst +++ b/docs/specs/index.rst @@ -31,3 +31,4 @@ guest hardware that is specific to QEMU. standard-vga virt-ctlr vmcoreinfo + vmgenid diff --git a/docs/specs/vmgenid.rst b/docs/specs/vmgenid.rst new file mode 100644 index 00000000000..9a3cefcd828 --- /dev/null +++ b/docs/specs/vmgenid.rst @@ -0,0 +1,246 @@ +Virtual Machine Generation ID Device +==================================== + +.. + Copyright (C) 2016 Red Hat, Inc. + Copyright (C) 2017 Skyport Systems, Inc. + + This work is licensed under the terms of the GNU GPL, version 2 or later. + See the COPYING file in the top-level directory. + +The VM generation ID (``vmgenid``) device is an emulated device which +exposes a 128-bit, cryptographically random, integer value identifier, +referred to as a Globally Unique Identifier, or GUID. + +This allows management applications (e.g. libvirt) to notify the guest +operating system when the virtual machine is executed with a different +configuration (e.g. snapshot execution or creation from a template). The +guest operating system notices the change, and is then able to react as +appropriate by marking its copies of distributed databases as dirty, +re-initializing its random number generator etc. + + +Requirements +------------ + +These requirements are extracted from the "How to implement virtual machine +generation ID support in a virtualization platform" section of +`the Microsoft Virtual Machine Generation ID specification +`_ dated August 1, 2012. + +- **R1a** The generation ID shall live in an 8-byte aligned buffer. + +- **R1b** The buffer holding the generation ID shall be in guest RAM, + ROM, or device MMIO range. + +- **R1c** The buffer holding the generation ID shall be kept separate from + areas used by the operating system. + +- **R1d** The buffer shall not be covered by an AddressRangeMemory or + AddressRangeACPI entry in the E820 or UEFI memory map. + +- **R1e** The generation ID shall not live in a page frame that could be + mapped with caching disabled. (In other words, regardless of whether the + generation ID lives in RAM, ROM or MMIO, it shall only be mapped as + cacheable.) + +- **R2** to **R5** [These AML requirements are isolated well enough in the + Microsoft specification for us to simply refer to them here.] + +- **R6** The hypervisor shall expose a _HID (hardware identifier) object + in the VMGenId device's scope that is unique to the hypervisor vendor. + + +QEMU Implementation +------------------- + +The above-mentioned specification does not dictate which ACPI descriptor table +will contain the VM Generation ID device. Other implementations (Hyper-V and +Xen) put it in the main descriptor table (Differentiated System Description +Table or DSDT). For ease of debugging and implementation, we have decided to +put it in its own Secondary System Description Table, or SSDT. + +The following is a dump of the contents from a running system:: + + # iasl -p ./SSDT -d /sys/firmware/acpi/tables/SSDT + + Intel ACPI Component Architecture + ASL+ Optimizing Compiler version 20150717-64 + Copyright (c) 2000 - 2015 Intel Corporation + + Reading ACPI table from file /sys/firmware/acpi/tables/SSDT - Length + 00000198 (0x0000C6) + ACPI: SSDT 0x0000000000000000 0000C6 (v01 BOCHS VMGENID 00000001 BXPC 00000001) + Acpi table [SSDT] successfully installed and loaded + Pass 1 parse of [SSDT] + Pass 2 parse of [SSDT] + Parsing Deferred Opcodes (Methods/Buffers/Packages/Regions) + + Parsing completed + Disassembly completed + ASL Output: ./SSDT.dsl - 1631 bytes + # cat SSDT.dsl + /* + * Intel ACPI Component Architecture + * AML/ASL+ Disassembler version 20150717-64 + * Copyright (c) 2000 - 2015 Intel Corporation + * + * Disassembling to symbolic ASL+ operators + * + * Disassembly of /sys/firmware/acpi/tables/SSDT, Sun Feb 5 00:19:37 2017 + * + * Original Table Header: + * Signature "SSDT" + * Length 0x000000CA (202) + * Revision 0x01 + * Checksum 0x4B + * OEM ID "BOCHS " + * OEM Table ID "VMGENID" + * OEM Revision 0x00000001 (1) + * Compiler ID "BXPC" + * Compiler Version 0x00000001 (1) + */ + DefinitionBlock ("/sys/firmware/acpi/tables/SSDT.aml", "SSDT", 1, "BOCHS ", "VMGENID", 0x00000001) + { + Name (VGIA, 0x07FFF000) + Scope (\_SB) + { + Device (VGEN) + { + Name (_HID, "QEMUVGID") // _HID: Hardware ID + Name (_CID, "VM_Gen_Counter") // _CID: Compatible ID + Name (_DDN, "VM_Gen_Counter") // _DDN: DOS Device Name + Method (_STA, 0, NotSerialized) // _STA: Status + { + Local0 = 0x0F + If ((VGIA == Zero)) + { + Local0 = Zero + } + + Return (Local0) + } + + Method (ADDR, 0, NotSerialized) + { + Local0 = Package (0x02) {} + Index (Local0, Zero) = (VGIA + 0x28) + Index (Local0, One) = Zero + Return (Local0) + } + } + } + + Method (\_GPE._E05, 0, NotSerialized) // _Exx: Edge-Triggered GPE + { + Notify (\_SB.VGEN, 0x80) // Status Change + } + } + + +Design Details: +--------------- + +Requirements R1a through R1e dictate that the memory holding the +VM Generation ID must be allocated and owned by the guest firmware, +in this case BIOS or UEFI. However, to be useful, QEMU must be able to +change the contents of the memory at runtime, specifically when starting a +backed-up or snapshotted image. In order to do this, QEMU must know the +address that has been allocated. + +The mechanism chosen for this memory sharing is writable fw_cfg blobs. +These are data object that are visible to both QEMU and guests, and are +addressable as sequential files. + +More information about fw_cfg can be found in :doc:`fw_cfg`. + +Two fw_cfg blobs are used in this case: + +``/etc/vmgenid_guid`` + +- contains the actual VM Generation ID GUID +- read-only to the guest + +``/etc/vmgenid_addr`` + +- contains the address of the downloaded vmgenid blob +- writable by the guest + + +QEMU sends the following commands to the guest at startup: + +1. Allocate memory for vmgenid_guid fw_cfg blob. +2. Write the address of vmgenid_guid into the SSDT (VGIA ACPI variable as + shown above in the iasl dump). Note that this change is not propagated + back to QEMU. +3. Write the address of vmgenid_guid back to QEMU's copy of vmgenid_addr + via the fw_cfg DMA interface. + +After step 3, QEMU is able to update the contents of vmgenid_guid at will. + +Since BIOS or UEFI does not necessarily run when we wish to change the GUID, +the value of VGIA is persisted via the VMState mechanism. + +As spelled out in the specification, any change to the GUID executes an +ACPI notification. The exact handler to use is not specified, so the vmgenid +device uses the first unused one: ``\_GPE._E05``. + + +Endian-ness Considerations: +--------------------------- + +Although not specified in Microsoft's document, it is assumed that the +device is expected to use little-endian format. + +All GUID passed in via command line or monitor are treated as big-endian. +GUID values displayed via monitor are shown in big-endian format. + + +GUID Storage Format: +-------------------- + +In order to implement an OVMF "SDT Header Probe Suppressor", the contents of +the vmgenid_guid fw_cfg blob are not simply a 128-bit GUID. There is also +significant padding in order to align and fill a memory page, as shown in the +following diagram:: + + +----------------------------------+ + | SSDT with OEM Table ID = VMGENID | + +----------------------------------+ + | ... | TOP OF PAGE + | VGIA dword object ---------------|-----> +---------------------------+ + | ... | | fw-allocated array for | + | _STA method referring to VGIA | | "etc/vmgenid_guid" | + | ... | +---------------------------+ + | ADDR method referring to VGIA | | 0: OVMF SDT Header probe | + | ... | | suppressor | + +----------------------------------+ | 36: padding for 8-byte | + | alignment | + | 40: GUID | + | 56: padding to page size | + +---------------------------+ + END OF PAGE + + +Device Usage: +------------- + +The device has one property, which may be only be set using the command line: + +``guid`` + sets the value of the GUID. A special value ``auto`` instructs + QEMU to generate a new random GUID. + +For example:: + + QEMU -device vmgenid,guid="324e6eaf-d1d1-4bf6-bf41-b9bb6c91fb87" + QEMU -device vmgenid,guid=auto + +The property may be queried via QMP/HMP:: + + (QEMU) query-vm-generation-id + {"return": {"guid": "324e6eaf-d1d1-4bf6-bf41-b9bb6c91fb87"}} + +Setting of this parameter is intentionally left out from the QMP/HMP +interfaces. There are no known use cases for changing the GUID once QEMU is +running, and adding this capability would greatly increase the complexity. diff --git a/docs/specs/vmgenid.txt b/docs/specs/vmgenid.txt deleted file mode 100644 index 80ff69f31cc..00000000000 --- a/docs/specs/vmgenid.txt +++ /dev/null @@ -1,245 +0,0 @@ -VIRTUAL MACHINE GENERATION ID -============================= - -Copyright (C) 2016 Red Hat, Inc. -Copyright (C) 2017 Skyport Systems, Inc. - -This work is licensed under the terms of the GNU GPL, version 2 or later. -See the COPYING file in the top-level directory. - -=== - -The VM generation ID (vmgenid) device is an emulated device which -exposes a 128-bit, cryptographically random, integer value identifier, -referred to as a Globally Unique Identifier, or GUID. - -This allows management applications (e.g. libvirt) to notify the guest -operating system when the virtual machine is executed with a different -configuration (e.g. snapshot execution or creation from a template). The -guest operating system notices the change, and is then able to react as -appropriate by marking its copies of distributed databases as dirty, -re-initializing its random number generator etc. - - -Requirements ------------- - -These requirements are extracted from the "How to implement virtual machine -generation ID support in a virtualization platform" section of the -specification, dated August 1, 2012. - - -The document may be found on the web at: - http://go.microsoft.com/fwlink/?LinkId=260709 - -R1a. The generation ID shall live in an 8-byte aligned buffer. - -R1b. The buffer holding the generation ID shall be in guest RAM, ROM, or device - MMIO range. - -R1c. The buffer holding the generation ID shall be kept separate from areas - used by the operating system. - -R1d. The buffer shall not be covered by an AddressRangeMemory or - AddressRangeACPI entry in the E820 or UEFI memory map. - -R1e. The generation ID shall not live in a page frame that could be mapped with - caching disabled. (In other words, regardless of whether the generation ID - lives in RAM, ROM or MMIO, it shall only be mapped as cacheable.) - -R2 to R5. [These AML requirements are isolated well enough in the Microsoft - specification for us to simply refer to them here.] - -R6. The hypervisor shall expose a _HID (hardware identifier) object in the - VMGenId device's scope that is unique to the hypervisor vendor. - - -QEMU Implementation -------------------- - -The above-mentioned specification does not dictate which ACPI descriptor table -will contain the VM Generation ID device. Other implementations (Hyper-V and -Xen) put it in the main descriptor table (Differentiated System Description -Table or DSDT). For ease of debugging and implementation, we have decided to -put it in its own Secondary System Description Table, or SSDT. - -The following is a dump of the contents from a running system: - -# iasl -p ./SSDT -d /sys/firmware/acpi/tables/SSDT - -Intel ACPI Component Architecture -ASL+ Optimizing Compiler version 20150717-64 -Copyright (c) 2000 - 2015 Intel Corporation - -Reading ACPI table from file /sys/firmware/acpi/tables/SSDT - Length -00000198 (0x0000C6) -ACPI: SSDT 0x0000000000000000 0000C6 (v01 BOCHS VMGENID 00000001 BXPC -00000001) -Acpi table [SSDT] successfully installed and loaded -Pass 1 parse of [SSDT] -Pass 2 parse of [SSDT] -Parsing Deferred Opcodes (Methods/Buffers/Packages/Regions) - -Parsing completed -Disassembly completed -ASL Output: ./SSDT.dsl - 1631 bytes -# cat SSDT.dsl -/* - * Intel ACPI Component Architecture - * AML/ASL+ Disassembler version 20150717-64 - * Copyright (c) 2000 - 2015 Intel Corporation - * - * Disassembling to symbolic ASL+ operators - * - * Disassembly of /sys/firmware/acpi/tables/SSDT, Sun Feb 5 00:19:37 2017 - * - * Original Table Header: - * Signature "SSDT" - * Length 0x000000CA (202) - * Revision 0x01 - * Checksum 0x4B - * OEM ID "BOCHS " - * OEM Table ID "VMGENID" - * OEM Revision 0x00000001 (1) - * Compiler ID "BXPC" - * Compiler Version 0x00000001 (1) - */ -DefinitionBlock ("/sys/firmware/acpi/tables/SSDT.aml", "SSDT", 1, "BOCHS ", -"VMGENID", 0x00000001) -{ - Name (VGIA, 0x07FFF000) - Scope (\_SB) - { - Device (VGEN) - { - Name (_HID, "QEMUVGID") // _HID: Hardware ID - Name (_CID, "VM_Gen_Counter") // _CID: Compatible ID - Name (_DDN, "VM_Gen_Counter") // _DDN: DOS Device Name - Method (_STA, 0, NotSerialized) // _STA: Status - { - Local0 = 0x0F - If ((VGIA == Zero)) - { - Local0 = Zero - } - - Return (Local0) - } - - Method (ADDR, 0, NotSerialized) - { - Local0 = Package (0x02) {} - Index (Local0, Zero) = (VGIA + 0x28) - Index (Local0, One) = Zero - Return (Local0) - } - } - } - - Method (\_GPE._E05, 0, NotSerialized) // _Exx: Edge-Triggered GPE - { - Notify (\_SB.VGEN, 0x80) // Status Change - } -} - - -Design Details: ---------------- - -Requirements R1a through R1e dictate that the memory holding the -VM Generation ID must be allocated and owned by the guest firmware, -in this case BIOS or UEFI. However, to be useful, QEMU must be able to -change the contents of the memory at runtime, specifically when starting a -backed-up or snapshotted image. In order to do this, QEMU must know the -address that has been allocated. - -The mechanism chosen for this memory sharing is writable fw_cfg blobs. -These are data object that are visible to both QEMU and guests, and are -addressable as sequential files. - -More information about fw_cfg can be found in "docs/specs/fw_cfg.txt" - -Two fw_cfg blobs are used in this case: - -/etc/vmgenid_guid - contains the actual VM Generation ID GUID - - read-only to the guest -/etc/vmgenid_addr - contains the address of the downloaded vmgenid blob - - writable by the guest - - -QEMU sends the following commands to the guest at startup: - -1. Allocate memory for vmgenid_guid fw_cfg blob. -2. Write the address of vmgenid_guid into the SSDT (VGIA ACPI variable as - shown above in the iasl dump). Note that this change is not propagated - back to QEMU. -3. Write the address of vmgenid_guid back to QEMU's copy of vmgenid_addr - via the fw_cfg DMA interface. - -After step 3, QEMU is able to update the contents of vmgenid_guid at will. - -Since BIOS or UEFI does not necessarily run when we wish to change the GUID, -the value of VGIA is persisted via the VMState mechanism. - -As spelled out in the specification, any change to the GUID executes an -ACPI notification. The exact handler to use is not specified, so the vmgenid -device uses the first unused one: \_GPE._E05. - - -Endian-ness Considerations: ---------------------------- - -Although not specified in Microsoft's document, it is assumed that the -device is expected to use little-endian format. - -All GUID passed in via command line or monitor are treated as big-endian. -GUID values displayed via monitor are shown in big-endian format. - - -GUID Storage Format: --------------------- - -In order to implement an OVMF "SDT Header Probe Suppressor", the contents of -the vmgenid_guid fw_cfg blob are not simply a 128-bit GUID. There is also -significant padding in order to align and fill a memory page, as shown in the -following diagram: - -+----------------------------------+ -| SSDT with OEM Table ID = VMGENID | -+----------------------------------+ -| ... | TOP OF PAGE -| VGIA dword object ---------------|-----> +---------------------------+ -| ... | | fw-allocated array for | -| _STA method referring to VGIA | | "etc/vmgenid_guid" | -| ... | +---------------------------+ -| ADDR method referring to VGIA | | 0: OVMF SDT Header probe | -| ... | | suppressor | -+----------------------------------+ | 36: padding for 8-byte | - | alignment | - | 40: GUID | - | 56: padding to page size | - +---------------------------+ - END OF PAGE - - -Device Usage: -------------- - -The device has one property, which may be only be set using the command line: - - guid - sets the value of the GUID. A special value "auto" instructs - QEMU to generate a new random GUID. - -For example: - - QEMU -device vmgenid,guid="324e6eaf-d1d1-4bf6-bf41-b9bb6c91fb87" - QEMU -device vmgenid,guid=auto - -The property may be queried via QMP/HMP: - - (QEMU) query-vm-generation-id - {"return": {"guid": "324e6eaf-d1d1-4bf6-bf41-b9bb6c91fb87"}} - -Setting of this parameter is intentionally left out from the QMP/HMP -interfaces. There are no known use cases for changing the GUID once QEMU is -running, and adding this capability would greatly increase the complexity. From patchwork Thu Nov 2 17:38:18 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 740464 Delivered-To: patch@linaro.org Received: by 2002:a5d:538f:0:b0:32d:baff:b0ca with SMTP id d15csp962290wrv; Thu, 2 Nov 2023 10:41:42 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHRcfeHhMmXqJXm8wbm6I8UTs+LUcYLtFgG1E3EZnCcEPXoVX64VXfVMhM68YHF5fto4rcL X-Received: by 2002:a05:6000:400e:b0:32d:d4c5:272b with SMTP id cp14-20020a056000400e00b0032dd4c5272bmr545658wrb.26.1698946902106; Thu, 02 Nov 2023 10:41:42 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1698946902; cv=none; d=google.com; s=arc-20160816; b=aK6HrZF6zTzUXiM0XuFicNSavONdmD8NO2fdXn8jHOAY0VxNUCC0ru8jPLxo788qWt JCLbbPJHM4E+YZtnv6svbOHdqbA/35OdSHefQLjbEkLxFdWupIXi7LQ21hcoTUKKQvAA FiCA8aaxSwohKCdlMkrqW3T/ZQX3iTg6LCmeK4cPAfLPDZId/h1Hxs6zC4aExcyNb3zR FcPqqFCUhZ4JLDN1KT32xomZiZoWHUTO7KzJ0qfQ/rsxvHnsA0jVoJwu2L/Mjj6PrhIE ft54U/P5Z+6gTfQdrLPJjXTgcPG2itWPydQ7M9LMSmn0yDSxwrbrRzbSp+UhdBIccpKm Al+Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:to:from :dkim-signature; bh=WxwZDBnTWEjluaiES2WHOUMnNxEIF8yiiLOlaYQXymk=; fh=PnYt+qEB9tAfMKoqBm2xjKOFpYyFFGPudh5cVIoieJM=; b=C31hxM62ALeQBqcvngQ9wgHel9KK0qGW8+ACZ7xXGxctkHNUbnpUGdCcfJKDnCYb36 qyxMfanrjgcq1S5YYNPsYKTd06xjhoU8EROcT8UYgvJxTZzSzu/zR7Sxd756WIu/X1PS c789hKu2/nq1L874wBqEoD2EfEsrUgwCemQcFl70f85kO/oZzuO8RMUkdOf8jlqvZQa2 MoKvqzeXLgs0ce1EJqs0scSlfG1Mov+gJyrq/pkF/GDP7+KXFZeC7AWDDbnLvHg/2Vj9 FbnvOWIErVjCmJF+IGUiLCd9/G94rESRG/bS+lg5erauiRXUHJbcNusgVtzb3qemlxkY xO5Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=YX1PuR3V; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id m7-20020a5d64a7000000b0032330e5868dsi1933541wrp.153.2023.11.02.10.41.42 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Thu, 02 Nov 2023 10:41:42 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=YX1PuR3V; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qybgY-0005gy-6r; Thu, 02 Nov 2023 13:40:55 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qybed-0003F7-R4 for qemu-devel@nongnu.org; Thu, 02 Nov 2023 13:38:52 -0400 Received: from mail-wm1-x333.google.com ([2a00:1450:4864:20::333]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qybea-0002jp-1J for qemu-devel@nongnu.org; Thu, 02 Nov 2023 13:38:51 -0400 Received: by mail-wm1-x333.google.com with SMTP id 5b1f17b1804b1-4081ccf69dcso13977675e9.0 for ; Thu, 02 Nov 2023 10:38:47 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1698946726; x=1699551526; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:from:to:cc:subject:date:message-id :reply-to; bh=WxwZDBnTWEjluaiES2WHOUMnNxEIF8yiiLOlaYQXymk=; b=YX1PuR3VKDXeTglGqVx6fQAUuBLH4eIgAkezV38UROt8KtsOckIO4kAAgbdFPy3z/+ maJiOCR/sA1av2GC4rYidQcvY64uyPWKvlLE+lsRuj540scoJtnfPrCTlXLpYHYVMvMO Sa+dtK6cqg24/0e4OO39r7xkJghsGqggIiA8EGBSO/ikIFbfKh41hMytKnt+gMEXId9g 9ziyO0vL7Dr6wDdV1f/sk5qHpxvp+w+JXnIS4PDUz1Pm8EYP9V17NALDtIPR98BCEc4Z z4UaLKl64+s/SLrulxtB0aOPg2+JeXYf2JsDG/Y0jkGWr0zm4eRPXT25hCX2ltNjCR2i G1Ig== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1698946726; x=1699551526; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=WxwZDBnTWEjluaiES2WHOUMnNxEIF8yiiLOlaYQXymk=; b=is/FeZSz551HwJWe6UyNR3ovgi/kLip/8NJzISdxs4jzHPXv/uI7pA1VUHpP0mE6n5 1ftNnom3A3RLDPWV/yIcskQ2t7oWc7XWdIhaBB3EWI34ck/nUfRulaf5pydFNUOGa5bD KrdYE2xggB5zd09eT/4f9MTS3wHkkDUCsYtpjg0jgFhKIxl9rck2mKNBTLqr0JCYIY3R t875c+F4WoMsnu1GLCJNovOvZieZ2hiks00NNEjYyvCI5V4KJezK/DXhwpZVKL8AGja1 CXHJp/I+r1O65UEHlITywYNeULma46xN3uTu8go4mxzfAEhHlGLocxSA/vU1Z52+9Qg1 cyug== X-Gm-Message-State: AOJu0YxD+yx4zr/hXDzhgpuyEcn2f/yhTyDbXu/g4rs/vBWV1NCYHcH1 IvEFiEXXJr7ze8euyYRDXJamAE/7/iL41mre5zo= X-Received: by 2002:a05:6000:186e:b0:32d:9d03:29e6 with SMTP id d14-20020a056000186e00b0032d9d0329e6mr550540wri.27.1698946726304; Thu, 02 Nov 2023 10:38:46 -0700 (PDT) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [2001:8b0:1d0::2]) by smtp.gmail.com with ESMTPSA id e16-20020adff350000000b003258934a4bcsm3046805wrp.42.2023.11.02.10.38.45 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 02 Nov 2023 10:38:46 -0700 (PDT) From: Peter Maydell To: qemu-devel@nongnu.org Subject: [PULL 16/33] MAINTAINERS: Make sure that gicv3_internal.h is covered, too Date: Thu, 2 Nov 2023 17:38:18 +0000 Message-Id: <20231102173835.609985-17-peter.maydell@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231102173835.609985-1-peter.maydell@linaro.org> References: <20231102173835.609985-1-peter.maydell@linaro.org> MIME-Version: 1.0 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, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org From: Thomas Huth gic_internal.h is already covered by the "ARM cores" section. Let's adapt the entry with a wildcard to cover gicv3_internal.h, too. Signed-off-by: Thomas Huth Reviewed-by: Philippe Mathieu-Daudé Message-id: 20231027060709.242388-1-thuth@redhat.com Signed-off-by: Peter Maydell --- MAINTAINERS | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/MAINTAINERS b/MAINTAINERS index 397c3967f6b..8e8a7d5be5d 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -687,7 +687,7 @@ M: Peter Maydell L: qemu-arm@nongnu.org S: Maintained F: hw/intc/arm* -F: hw/intc/gic_internal.h +F: hw/intc/gic*_internal.h F: hw/misc/a9scu.c F: hw/misc/arm11scu.c F: hw/misc/arm_l2x0.c From patchwork Thu Nov 2 17:38:19 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 740447 Delivered-To: patch@linaro.org Received: by 2002:a5d:538f:0:b0:32d:baff:b0ca with SMTP id d15csp961400wrv; Thu, 2 Nov 2023 10:39:37 -0700 (PDT) X-Google-Smtp-Source: AGHT+IE6kkyixURu2ptmPTg4uIAhB3IWvjFwP2tRNgZpGn+gtvR9M+6Znj3xIC/o1oarHm6CKzn6 X-Received: by 2002:a05:620a:24d4:b0:773:fa62:39fe with SMTP id m20-20020a05620a24d400b00773fa6239femr334979qkn.1.1698946777117; Thu, 02 Nov 2023 10:39:37 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1698946777; cv=none; d=google.com; s=arc-20160816; b=J25IrOAffLekSlK+sdrD51Zet+itneurtfiXkrbLTTvBT0dJG7+gsmgeSGedgKeB9v +We7OylaQmtw6au4y0ZJK0wNqy7VR6ChyXN77GCLVz+BNFG3MzN4RjmdNPxairJaO0lD yEfEfDGDNJiK3+vI5EH3tPlnwk6ZgAVg78ZO9pwaa+EW1lBbYwyWKyq1wrCyAM46Ic2S FzDnZdOJg0hszOLl6VGZMOpEovR70oKBUVIAlBqjXhR/lZkIwTci4gmqIsKjP/3YN5BC xT5d7qLLaMqfAVlT3mOV5gJMdTWC7bST+T+q1fLueeEaEn/xyBA67T9DD9ujryeo18+f 8f9Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:to:from :dkim-signature; bh=uKA7bn5x9XExQ1qcDE6U/Plr8Mt6ZUx9Ro4D4g9gp3I=; fh=PnYt+qEB9tAfMKoqBm2xjKOFpYyFFGPudh5cVIoieJM=; b=T8s2r3Y3rMjhA9VjT/2LOCGcmSd6MwB4ytvLeZ3eiy/C+2k0Hrjh2eMcA8tzYRZLLF P2RFRbYEjxg22RSis/KKO/ZCbPJWqpkiXvLew9bCEHLaOQQh0QSU94OEKXPofxWStjKQ 7RpkgM0HWs0Bpd2EXn989vEQetf665fuWIDj0oA1nIsrG1aE4rXQZcnrwbQLj47bebGF HsIkL3CyLFaQf4Etw0CV12Vd6mWZRwFT8W3zBwFZQKW8ODQvwKdAIN0WuTky7qvfXVHN s8jP3wqcQvlotL+uSU7kz2aMP37OMTiPmX1tJOZJX0s3rAT7HAuShpClrGThYlPbESi2 0ZSA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=iKH9OZij; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id qs19-20020a05620a395300b00767cc0f9316si292249qkn.289.2023.11.02.10.39.36 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Thu, 02 Nov 2023 10:39:37 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=iKH9OZij; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qybf9-0003Ow-5r; Thu, 02 Nov 2023 13:39:27 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qybef-0003FN-Jh for qemu-devel@nongnu.org; Thu, 02 Nov 2023 13:38:53 -0400 Received: from mail-wm1-x32f.google.com ([2a00:1450:4864:20::32f]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qybea-0002l8-1S for qemu-devel@nongnu.org; Thu, 02 Nov 2023 13:38:52 -0400 Received: by mail-wm1-x32f.google.com with SMTP id 5b1f17b1804b1-40859c466efso8808465e9.3 for ; Thu, 02 Nov 2023 10:38:47 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1698946726; x=1699551526; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:from:to:cc:subject:date:message-id :reply-to; bh=uKA7bn5x9XExQ1qcDE6U/Plr8Mt6ZUx9Ro4D4g9gp3I=; b=iKH9OZijOU6qzxIy9L2zPGBID+Tu58jVZ/PtVAoKj8qxhBM28cUWoH/O5qS7lcbjho 8O9IxISmICpvnNniQXeeo4IwGTj+NkWbj98aOAgBzMSQJZfF9T04KILveajNEfpEjjol T3Fo1usA7hrs5ymHeubWRxjfzGMJPJ8qsgRd+4dk0/EOlFSD8CXj+StrAwk4rnxpLnrZ zjqBWOTEMxL+iB2nYcuoQloN5aLxFGglGlMVlyoapvZMMV2GfPNth48u56Lq/QWzilcZ DCrO29z5pXrI32qGF5BYUmFBQ65KmqaeYbi7XCje0XMLCGi3wOYtUO25aHsgXVzdiHc7 GSLw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1698946726; x=1699551526; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=uKA7bn5x9XExQ1qcDE6U/Plr8Mt6ZUx9Ro4D4g9gp3I=; b=LBiR+Pn5Er1fwclT7aYlvDPDNX/Q47x9pwuEHohxILudNp0ypqf3/sU8t3Q+lQ3aJ1 SngQxjIa02lwClM9T6f0h1TLAf6avu0lSgCaThYa6pk+0UH2rMBckjifdp3VbAeibLOR I2x6u+ix1ZkPh/nbpbXb/x0QAhU62iPz1SGix0ttOJQ6H9zXUn7UtIlKuixj31CWeZMb uNylWOOJj/MmUIgezWprl/7/OyFm0B/RY16xpxAeNmbr/Sj0c3DlwjNwf/lr6BUluLj8 RaoxjDaapJlvvF4hSfbpveauA5u3oEnNThrLC/s8V1ykEC8WL8nrQuoAKdZdnNDvai+l HNuQ== X-Gm-Message-State: AOJu0YzfJtRtamrHFmJwC+WUmEY8riC8M0U4u6SFUPR8QIH1AhP/dQnu IrcSm496gEOfH4+joc4Zy3AwpB7C15pIC/yFUos= X-Received: by 2002:a5d:64c8:0:b0:32f:9977:eefd with SMTP id f8-20020a5d64c8000000b0032f9977eefdmr6914028wri.42.1698946726702; Thu, 02 Nov 2023 10:38:46 -0700 (PDT) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [2001:8b0:1d0::2]) by smtp.gmail.com with ESMTPSA id e16-20020adff350000000b003258934a4bcsm3046805wrp.42.2023.11.02.10.38.46 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 02 Nov 2023 10:38:46 -0700 (PDT) From: Peter Maydell To: qemu-devel@nongnu.org Subject: [PULL 17/33] hw/arm/pxa2xx_gpio: Pass CPU using QOM link property Date: Thu, 2 Nov 2023 17:38:19 +0000 Message-Id: <20231102173835.609985-18-peter.maydell@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231102173835.609985-1-peter.maydell@linaro.org> References: <20231102173835.609985-1-peter.maydell@linaro.org> MIME-Version: 1.0 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, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org From: Philippe Mathieu-Daudé Instead of passing the CPU index and resolving it, use a QOM link to directly pass the CPU. Signed-off-by: Philippe Mathieu-Daudé Message-id: 20231030083706.63685-1-philmd@linaro.org Reviewed-by: Peter Maydell Signed-off-by: Peter Maydell --- hw/arm/pxa2xx_gpio.c | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/hw/arm/pxa2xx_gpio.c b/hw/arm/pxa2xx_gpio.c index e7c3d99224a..c8db5e8e2b7 100644 --- a/hw/arm/pxa2xx_gpio.c +++ b/hw/arm/pxa2xx_gpio.c @@ -32,7 +32,6 @@ struct PXA2xxGPIOInfo { MemoryRegion iomem; qemu_irq irq0, irq1, irqX; int lines; - int ncpu; ARMCPU *cpu; /* XXX: GNU C vectors are more suitable */ @@ -266,12 +265,11 @@ static const MemoryRegionOps pxa_gpio_ops = { DeviceState *pxa2xx_gpio_init(hwaddr base, ARMCPU *cpu, DeviceState *pic, int lines) { - CPUState *cs = CPU(cpu); DeviceState *dev; dev = qdev_new(TYPE_PXA2XX_GPIO); qdev_prop_set_int32(dev, "lines", lines); - qdev_prop_set_int32(dev, "ncpu", cs->cpu_index); + object_property_set_link(OBJECT(dev), "cpu", OBJECT(cpu), &error_abort); sysbus_realize_and_unref(SYS_BUS_DEVICE(dev), &error_fatal); sysbus_mmio_map(SYS_BUS_DEVICE(dev), 0, base); @@ -303,8 +301,6 @@ static void pxa2xx_gpio_realize(DeviceState *dev, Error **errp) { PXA2xxGPIOInfo *s = PXA2XX_GPIO(dev); - s->cpu = ARM_CPU(qemu_get_cpu(s->ncpu)); - qdev_init_gpio_in(dev, pxa2xx_gpio_set, s->lines); qdev_init_gpio_out(dev, s->handler, s->lines); } @@ -339,7 +335,7 @@ static const VMStateDescription vmstate_pxa2xx_gpio_regs = { static Property pxa2xx_gpio_properties[] = { DEFINE_PROP_INT32("lines", PXA2xxGPIOInfo, lines, 0), - DEFINE_PROP_INT32("ncpu", PXA2xxGPIOInfo, ncpu, 0), + DEFINE_PROP_LINK("cpu", PXA2xxGPIOInfo, cpu, TYPE_ARM_CPU, ARMCPU *), DEFINE_PROP_END_OF_LIST(), }; From patchwork Thu Nov 2 17:38:20 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 740468 Delivered-To: patch@linaro.org Received: by 2002:a5d:538f:0:b0:32d:baff:b0ca with SMTP id d15csp962589wrv; Thu, 2 Nov 2023 10:42:27 -0700 (PDT) X-Google-Smtp-Source: AGHT+IE58ZUuDlPekneRR5eWwESJXUYd7luGe3SU/k4XPLmwdWK4YP6zXOECOIF7QcdRRSjVGcu2 X-Received: by 2002:a5d:6d89:0:b0:32f:7b2e:2ea with SMTP id l9-20020a5d6d89000000b0032f7b2e02eamr13796017wrs.32.1698946947406; Thu, 02 Nov 2023 10:42:27 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1698946947; cv=none; d=google.com; s=arc-20160816; b=Pa+lO/jCAmTHakDOEF9pGUMK/tqiDm3fxXSLDLJzdEVOXcVFwk7Fef5mninNbgypc1 LHEGVJVBCrAjmIbm0BMJ2wRhyFXRVogFR4NDduHCHsqWDwEIzGbFq0tNpYEwDduBglW3 7imrfKYanTlTU/zL2IsVmZAAcdT5LC0LUB6mbJUuG8uEaEF69X4fA1j5dZxe36RONWlI ohVPLLCssKu3mETKyclMXitLr+53/IAv4VLRYXrls5AOKaxzBs1LtgBz+VyT/0B2EVLB U5eixZzUDD9+Z83oUH9Skg/rPZVG/rbViogFd5D/KVEObdUwG288R9AYWCBeeah5BlhM rjiQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:to:from :dkim-signature; bh=OufKB18os/HPYVeDiWWwuMKqpNGGWOwdFVtfIjwPxs4=; fh=PnYt+qEB9tAfMKoqBm2xjKOFpYyFFGPudh5cVIoieJM=; b=h/GX56JcETt+xq2yl+DOmeta0XpgneHDqfQ8Odztfe3BgyBqFAGm3vXup9JtxP1DDu S4xzudH0Z1afnMHQAsp3tIrdom1Mfm8sojAR9BtForsPSOSaTWp0LSavfSu8jAaiVn9W BoRPTyGxsEoootJzqeu5q7qmCT0cS0Nal2QJuSOyB/7W3pmJOWeArzuOL+g/Um9KDeFl 3+m5zr/OK/B6WFhlS1wkI/f2vVjh7oHCfmtd3dKfitSx16hT0ar4QolUfUtwsjdtDW6N JffhlikeWeWiNQhT2oY9gCZjuTW3LQqpHvhG7RpzoBbR+ZpYXC+CUBPmU9hofWT1Kbwt AROw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=uiwep+gx; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id i16-20020a5d5590000000b0032336ee77d7si1779902wrv.724.2023.11.02.10.42.27 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Thu, 02 Nov 2023 10:42:27 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=uiwep+gx; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qybfG-0003TN-7l; Thu, 02 Nov 2023 13:39:30 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qybef-0003FM-Hq for qemu-devel@nongnu.org; Thu, 02 Nov 2023 13:38:53 -0400 Received: from mail-wm1-x332.google.com ([2a00:1450:4864:20::332]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qybeb-0002lP-Op for qemu-devel@nongnu.org; Thu, 02 Nov 2023 13:38:52 -0400 Received: by mail-wm1-x332.google.com with SMTP id 5b1f17b1804b1-40853c639abso8954925e9.0 for ; Thu, 02 Nov 2023 10:38:48 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1698946727; x=1699551527; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:from:to:cc:subject:date:message-id :reply-to; bh=OufKB18os/HPYVeDiWWwuMKqpNGGWOwdFVtfIjwPxs4=; b=uiwep+gxo5/Zlk+jrA/DtLTGNFb180/b59j6myLzJTgSd93z97x5Fe8OVTQPi2hFNG M/57+ZolPTYO9GkF5LpLZZOJCj2yfA7hEH0NmM9XUyjXXRnqo2zMWIsOalQCo/FJLJfM Z8jz0wIjG5+hzle8lusgMIOtrN9C8W7r5OdtMc7eMN9jOxrxtCH9Xyi/ds0VdtPG171m BIOC+WHADq4uSj/j5anR7Ypuus0/L7E0dqDMSjqSNH26VMU/UhLDGm6+QGAqSZQflMJq hq+HoajBjg4tvKC/H9NLF2T4HRAQDWxK4Nel+3WiUxyEegZWbARlsWwjBNvo9DRRKUJM LGog== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1698946727; x=1699551527; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=OufKB18os/HPYVeDiWWwuMKqpNGGWOwdFVtfIjwPxs4=; b=CO7xEPoRBX0gmbDrlhWtC0eX2axeSyrqw6hM+zVhUrH8q0tcoxEMYCfEh1WromRjYT Ar/WSwyijgSLMWzC3VoPzNl9Y60hGC8+al3UNSqfvhJJ9vF9W/41mpJoKF+FIC9wzIol o4Kbk1rdI25CF/1pWX0v4dgdyrya3yaq+mtp5iU3TmLgjka3d6vDRu4h29YB7K73zoCm LmEWVxIJr4w/HrlOdoHJETHPG7xOER1YcSr/X9KzsmRtkaiSoSoOTro0WXxfdVvX0VPE qGW5+1WAy5xJGnVWmL6fqtdNZOnrP8wXOMq5mZJfx7jPa5CmUO/7pItHGnFHw1zva7MV mpfg== X-Gm-Message-State: AOJu0Yz4MBk1XRrl/S5nuWdm+BMDnj/+H0NHge+ZZoIPpQB9YIY2QU5S 4RFKqM/GWgkafozuL7lAtKN6wKAZE1T0q3mQ4go= X-Received: by 2002:a5d:5e87:0:b0:32d:a427:7fda with SMTP id ck7-20020a5d5e87000000b0032da4277fdamr17673036wrb.48.1698946727193; Thu, 02 Nov 2023 10:38:47 -0700 (PDT) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [2001:8b0:1d0::2]) by smtp.gmail.com with ESMTPSA id e16-20020adff350000000b003258934a4bcsm3046805wrp.42.2023.11.02.10.38.46 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 02 Nov 2023 10:38:46 -0700 (PDT) From: Peter Maydell To: qemu-devel@nongnu.org Subject: [PULL 18/33] hw/watchdog/wdt_imx2: Trace MMIO access Date: Thu, 2 Nov 2023 17:38:20 +0000 Message-Id: <20231102173835.609985-19-peter.maydell@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231102173835.609985-1-peter.maydell@linaro.org> References: <20231102173835.609985-1-peter.maydell@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::332; envelope-from=peter.maydell@linaro.org; helo=mail-wm1-x332.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, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org From: Bernhard Beschow Signed-off-by: Bernhard Beschow Reviewed-by: Philippe Mathieu-Daudé Message-id: 20231028122415.14869-2-shentey@gmail.com Signed-off-by: Peter Maydell --- hw/watchdog/wdt_imx2.c | 24 ++++++++++++++++++------ hw/watchdog/trace-events | 4 ++++ 2 files changed, 22 insertions(+), 6 deletions(-) diff --git a/hw/watchdog/wdt_imx2.c b/hw/watchdog/wdt_imx2.c index e776a2fbd40..885ebd39787 100644 --- a/hw/watchdog/wdt_imx2.c +++ b/hw/watchdog/wdt_imx2.c @@ -17,6 +17,7 @@ #include "hw/qdev-properties.h" #include "hw/watchdog/wdt_imx2.h" +#include "trace.h" static void imx2_wdt_interrupt(void *opaque) { @@ -67,20 +68,29 @@ static void imx2_wdt_reset(DeviceState *dev) static uint64_t imx2_wdt_read(void *opaque, hwaddr addr, unsigned int size) { IMX2WdtState *s = IMX2_WDT(opaque); + uint16_t value = 0; switch (addr) { case IMX2_WDT_WCR: - return s->wcr; + value = s->wcr; + break; case IMX2_WDT_WSR: - return s->wsr; + value = s->wsr; + break; case IMX2_WDT_WRSR: - return s->wrsr; + value = s->wrsr; + break; case IMX2_WDT_WICR: - return s->wicr; + value = s->wicr; + break; case IMX2_WDT_WMCR: - return s->wmcr; + value = s->wmcr; + break; } - return 0; + + trace_imx2_wdt_read(addr, value); + + return value; } static void imx_wdt2_update_itimer(IMX2WdtState *s, bool start) @@ -137,6 +147,8 @@ static void imx2_wdt_write(void *opaque, hwaddr addr, { IMX2WdtState *s = IMX2_WDT(opaque); + trace_imx2_wdt_write(addr, value); + switch (addr) { case IMX2_WDT_WCR: if (s->wcr_locked) { diff --git a/hw/watchdog/trace-events b/hw/watchdog/trace-events index 2739570652b..874968cc06a 100644 --- a/hw/watchdog/trace-events +++ b/hw/watchdog/trace-events @@ -17,6 +17,10 @@ cmsdk_apb_watchdog_lock(uint32_t lock) "CMSDK APB watchdog: lock %" PRIu32 aspeed_wdt_read(uint64_t addr, uint32_t size) "@0x%" PRIx64 " size=%d" aspeed_wdt_write(uint64_t addr, uint32_t size, uint64_t data) "@0x%" PRIx64 " size=%d value=0x%"PRIx64 +# wdt_imx2.c +imx2_wdt_read(uint32_t addr, uint16_t data) "[0x%" PRIx32 "] -> 0x%" PRIx16 +imx2_wdt_write(uint32_t addr, uint16_t data) "[0x%" PRIx32 "] <- 0x%" PRIx16 + # spapr_watchdog.c spapr_watchdog_start(uint64_t flags, uint64_t num, uint64_t timeout) "Flags 0x%" PRIx64 " num=%" PRId64 " %" PRIu64 "ms" spapr_watchdog_stop(uint64_t num, uint64_t ret) "num=%" PRIu64 " ret=%" PRId64 From patchwork Thu Nov 2 17:38:21 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 740474 Delivered-To: patch@linaro.org Received: by 2002:a5d:538f:0:b0:32d:baff:b0ca with SMTP id d15csp963940wrv; Thu, 2 Nov 2023 10:45:44 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHv+bYhOLsMIHukEbLNm0TNhk+87I5ZGi7xpuz8CWvr9tf2zIVDOXsXS/Iz0rfPhIVLnSBG X-Received: by 2002:a05:600c:4748:b0:3fb:feb0:6f40 with SMTP id w8-20020a05600c474800b003fbfeb06f40mr16308495wmo.11.1698947144652; Thu, 02 Nov 2023 10:45:44 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1698947144; cv=none; d=google.com; s=arc-20160816; b=CatlTInJz7x4tK0gbsvfM1oyZGxAQjtkFUYsVeQpgzsgGOhmZYhbEwdy/xs5IIrbXX VQ8fiIYlNAowh0tuBY0acn15RG4eyRVjaS3vpxqgSOf4iG43EkmhrMEJBAuYpVFjumnM nqmsrmPigIoVJe/hnjQYPHZ8F3gf9TyhvX16+BgDv4M2sZgOjPOaCzS4HqZRw9hbRYbB BF45w8y4S/wiO+Ccu+ZcBOTzQxk9qQN76aQyo+2t1YQ3o1d9QWGBmD/Qk80W6IoKnPvb Q8CO9p/hkh+ub/rp2U3OfoUucSOd82xLd44C7/h/if0fsgX/Rds/MCfVRm4hqh0O5VDQ 5iZA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:to:from :dkim-signature; bh=iD8xvESJqhMdvRBcqDuQwzM17Zf84AgBfxQAOku4bfg=; fh=PnYt+qEB9tAfMKoqBm2xjKOFpYyFFGPudh5cVIoieJM=; b=Rse85iK5mKZAfTpIH9Zysvc8xFlAvBzUKzY0k6stP550iWSnWZWUvO1Td+PbKlBhVs d1Tih35nGSicu4VILJSbXfke5roLf/glIpuMMWRNBqwJkVTDqzCgZUbR4FVXFZXTWyg9 PvBuQMTyS60Te1+UtxLlND2gwz4eFf55S5kHlrQQZEkFPYYmifKJxiLTmhD6pmBLxbjt g9l3LyaO6WTbkDdXEbntU6pKIG2Bu6pdkBFi0M/mNUYs3MKK56XG1qehGPad4FGcBxfk 1jplbjLTihLrmoPUBQbhIR7lzK8CBci+nZNtyx/7tOhU3gm3ZNXO7tH2XlTfgyORCXY5 Ysjw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=BB6Eu+7U; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id k18-20020a05600c1c9200b00409388499d3si1936053wms.103.2023.11.02.10.45.44 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Thu, 02 Nov 2023 10:45:44 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=BB6Eu+7U; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qybfL-0003ZR-FP; Thu, 02 Nov 2023 13:39:35 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qybeh-0003Gp-Fg for qemu-devel@nongnu.org; Thu, 02 Nov 2023 13:38:55 -0400 Received: from mail-lf1-x136.google.com ([2a00:1450:4864:20::136]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qybeb-0002lX-Vn for qemu-devel@nongnu.org; Thu, 02 Nov 2023 13:38:54 -0400 Received: by mail-lf1-x136.google.com with SMTP id 2adb3069b0e04-50939d39d0fso1531699e87.1 for ; Thu, 02 Nov 2023 10:38:49 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1698946727; x=1699551527; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:from:to:cc:subject:date:message-id :reply-to; bh=iD8xvESJqhMdvRBcqDuQwzM17Zf84AgBfxQAOku4bfg=; b=BB6Eu+7UYCnQUq9+1kXS46sSQX1D1IzbjlZkNGUicpvE/OnaClV26NzAhcqMvecS9+ QgVxD8ggm+ttlamFf0fWRnd0aVBu9HNXXpldgYkMXcvRdx1JG/uEQ7i8k2sTe/CRC6U0 dfhpKiBJ/bB9vE61CoOA5iq4yDKFtm8w5nR9NF0S1gtjdVeguC2bDhZKUDj9hbLkG1z0 fXuNzIuUQQlS98ZIkiKtjn78LYryIeo3876dioUkslQ4fbcTgY9JmBL/MbZCQiZFq/Wu lC/MZtMGdcaqzZG4Znx6ia8tjJMKit+7H+pnHZUPw1eVmXj3UbE/KIB2+uHo6JaNmVwv bTdw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1698946727; x=1699551527; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=iD8xvESJqhMdvRBcqDuQwzM17Zf84AgBfxQAOku4bfg=; b=hksqG/NZf6cWllQzBFMllRd94zesBpQKbWm6M6BCfIOyRqpb9nCkDOk3L3Uz7LHLD8 NHK79SGzGHDvdPobKWa1HJx2ncyOj4iql2jTmRtpvRhEpquXC8c0wwo4PrZ7lx+XmU/b i5YYRJFUf8uqjc39Z1aehU4oWdIkawxj2xh+YPhCuT+kvDDSfmDrYZsZbnz7qyAvxM1O P4ofc6LMoUKLeWq+eDPzSMEvWqtPioroRXoyJlZ+U18sOFatCN9e7XgSI/Nc9IcOuyIT vZQviX23hO0MJqgnVuWghPLDcdvX15Qa92bHOSJIm0bzMTVS1t7Wu9i8lq/7svdbKuNo 2HAg== X-Gm-Message-State: AOJu0YxtvoATEuVXIJJxVAQPm/I+1HqAxn7Ur7/xek/nD7vtY/EulEOi gYiHP3zwc95FwVRPqGtvCU6UNxQCV29JVBbp2JE= X-Received: by 2002:a05:6512:b87:b0:509:4424:2e13 with SMTP id b7-20020a0565120b8700b0050944242e13mr4110590lfv.65.1698946727592; Thu, 02 Nov 2023 10:38:47 -0700 (PDT) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [2001:8b0:1d0::2]) by smtp.gmail.com with ESMTPSA id e16-20020adff350000000b003258934a4bcsm3046805wrp.42.2023.11.02.10.38.47 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 02 Nov 2023 10:38:47 -0700 (PDT) From: Peter Maydell To: qemu-devel@nongnu.org Subject: [PULL 19/33] hw/watchdog/wdt_imx2: Trace timer activity Date: Thu, 2 Nov 2023 17:38:21 +0000 Message-Id: <20231102173835.609985-20-peter.maydell@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231102173835.609985-1-peter.maydell@linaro.org> References: <20231102173835.609985-1-peter.maydell@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::136; envelope-from=peter.maydell@linaro.org; helo=mail-lf1-x136.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, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org From: Bernhard Beschow Signed-off-by: Bernhard Beschow Message-id: 20231028122415.14869-3-shentey@gmail.com Reviewed-by: Peter Maydell Signed-off-by: Peter Maydell --- hw/watchdog/wdt_imx2.c | 4 ++++ hw/watchdog/trace-events | 2 ++ 2 files changed, 6 insertions(+) diff --git a/hw/watchdog/wdt_imx2.c b/hw/watchdog/wdt_imx2.c index 885ebd39787..891d7beb2a1 100644 --- a/hw/watchdog/wdt_imx2.c +++ b/hw/watchdog/wdt_imx2.c @@ -23,6 +23,8 @@ static void imx2_wdt_interrupt(void *opaque) { IMX2WdtState *s = IMX2_WDT(opaque); + trace_imx2_wdt_interrupt(); + s->wicr |= IMX2_WDT_WICR_WTIS; qemu_set_irq(s->irq, 1); } @@ -31,6 +33,8 @@ static void imx2_wdt_expired(void *opaque) { IMX2WdtState *s = IMX2_WDT(opaque); + trace_imx2_wdt_expired(); + s->wrsr = IMX2_WDT_WRSR_TOUT; /* Perform watchdog action if watchdog is enabled */ diff --git a/hw/watchdog/trace-events b/hw/watchdog/trace-events index 874968cc06a..ad3be1e9bdd 100644 --- a/hw/watchdog/trace-events +++ b/hw/watchdog/trace-events @@ -20,6 +20,8 @@ aspeed_wdt_write(uint64_t addr, uint32_t size, uint64_t data) "@0x%" PRIx64 " si # wdt_imx2.c imx2_wdt_read(uint32_t addr, uint16_t data) "[0x%" PRIx32 "] -> 0x%" PRIx16 imx2_wdt_write(uint32_t addr, uint16_t data) "[0x%" PRIx32 "] <- 0x%" PRIx16 +imx2_wdt_interrupt(void) "" +imx2_wdt_expired(void) "" # spapr_watchdog.c spapr_watchdog_start(uint64_t flags, uint64_t num, uint64_t timeout) "Flags 0x%" PRIx64 " num=%" PRId64 " %" PRIu64 "ms" From patchwork Thu Nov 2 17:38:22 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 740475 Delivered-To: patch@linaro.org Received: by 2002:a5d:538f:0:b0:32d:baff:b0ca with SMTP id d15csp964123wrv; Thu, 2 Nov 2023 10:46:09 -0700 (PDT) X-Google-Smtp-Source: AGHT+IEjNKrsnhKSmojEE6I97OgIw0BkF7+wLhPtffRIE1VK4KfLdiVI8OymCQKZQeqZBZAVlwYV X-Received: by 2002:a5d:6d8a:0:b0:32f:76f4:b2b with SMTP id l10-20020a5d6d8a000000b0032f76f40b2bmr681316wrs.11.1698947168875; Thu, 02 Nov 2023 10:46:08 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1698947168; cv=none; d=google.com; s=arc-20160816; b=ssITNRcoJfDs6is663iJCc8zV0xed5mUxGTfRFMb7AGJoGcJKbfGiSnNRjha9OK/wL jy5E51hDOO24i+fymSMS6r0jiAGquO2mRBSFFV9x8E9xOe24AlnJAE8gdb3AQrkiHdbe ayhU5i3XhyQP7fQJWqrQDqPtoddefXYkOns3aPLHy7yo159kHWKWRVAwY9vVsqeUiyms XZvDX7A6QpHcvUC7Nrf0rBTUDFPwT961bGu0eEsghGqVX5ueWlb8laOT2KIev0g/AB2y WuNEBDbTbgUPO1Tl1Evmru5+uqKCnTHgS3/5lLHJP6J/LfC1b0FGM6gu1FgwXrnxGhX6 lo0Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:to:from :dkim-signature; bh=nbey4SZJJmXe8K8MAAeguqkbXwo5FmAHlW76eEXbodE=; fh=PnYt+qEB9tAfMKoqBm2xjKOFpYyFFGPudh5cVIoieJM=; b=s6OfQmabaHqIzbBhBBB9SRaXllPfNuvlHme9qWVrq+FcEv2XC/I4IDrj3Py5jsoJtj ITo4eLo68nUgsXRFjHl/4pYMMZ25RkME7fQKZdxwAUI71sU+Rz/YNAagjnBSUQhHbAqG ZEizGfS8WpIGctw7kXFt4IKJiCFmWFu8jEKHIyrK7bUoAbK1PiGw3GJuZ1gBkLMXRFMm 0zySfHPC8fN5/4JARpRD0h0P6u+aQeBFnCofP6cD7FauCy7fP8OJ68GhoLlkAspO8R2K zjkFEq04FJYGYl2Jl4lyDcniJuOZ7bFb+5dGN3sbxeSoQjOhCIeJRLHWGnKYoYb3mFnp c01Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=yqWPCkG8; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id w9-20020a5d6809000000b0032f7cc7e9f6si1872811wru.730.2023.11.02.10.46.08 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Thu, 02 Nov 2023 10:46:08 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=yqWPCkG8; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qybfI-0003Wa-GV; Thu, 02 Nov 2023 13:39:32 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qybeg-0003GP-1L for qemu-devel@nongnu.org; Thu, 02 Nov 2023 13:38:54 -0400 Received: from mail-wm1-x32c.google.com ([2a00:1450:4864:20::32c]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qybeb-0002lu-Pg for qemu-devel@nongnu.org; Thu, 02 Nov 2023 13:38:53 -0400 Received: by mail-wm1-x32c.google.com with SMTP id 5b1f17b1804b1-40907b82ab9so13849115e9.1 for ; Thu, 02 Nov 2023 10:38:48 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1698946728; x=1699551528; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:from:to:cc:subject:date:message-id :reply-to; bh=nbey4SZJJmXe8K8MAAeguqkbXwo5FmAHlW76eEXbodE=; b=yqWPCkG8gRWiPSEa5W7styRvbGW2SqaJTDw8l2D+bsQSIR/qYp+4X1zhnGx+VZ5xYj 3nDJvhWS5uZMBWK8YEatqaS46cZcJKhaG3JEx8f4pXqyhtzXYjbCnFUY6LN403BcpQ2t unkEveSdD1h6h9CAg4LcYWT8Vkb3nMMmbzov5XF8rrETZOQFjGNROmKTZWZ0MOXaHV5z P5jSd/gXq+zwTdI9PyN85MRMvkTonRMSwmNx6D8rDiWNcMl8bsPpXGP0foQWLLYCiWBY llni3ifp7eZpYwQRgTl4X4yXjeKYut/ZDUQL1BOwG/U9bvvfuwzK0gP48zmkk06Vm++W cpxQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1698946728; x=1699551528; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=nbey4SZJJmXe8K8MAAeguqkbXwo5FmAHlW76eEXbodE=; b=ugsjNJd2T5XxU/M5Ks1URmQtf1vMlC8ZOXDJxFKyRoaS1hwSjlu0yPAWZZOPAqHOXP 3pADi/s31cn0mALkYDQ1KpO8aMDRLOsHFfNbS5bEPfCwYD/RVkG4HVx+F9Qgdb/F1Pa9 SHxlyeK3N/gRwmtZjKFCec8n0augfoEMJnhwfiWUtaPAjVLQcsb6G5eksXMjDIDPUlWp pTzsmUUm/NrI+43AX4N0Mfmu2n9vheC96VYxkJ+PQx/AkWN0d7XFx/Vr1yi3x8uHZfpu vxexPbRuH8Y4VbdwLAclMuZ9CkEcJ2x4mV/tHDO3a+WTFimebhNMayeZFCFKoem4Fdiw hvTw== X-Gm-Message-State: AOJu0Yw8SbjNggt6t2wzQ12rbhRCyuWoUts5Rbx70lTV/s7VLTlYrt3E dB9AeRGED4JOntOilehI0OPAQWzxKT3AmA36yfs= X-Received: by 2002:a05:6000:1846:b0:32d:8a7c:6efc with SMTP id c6-20020a056000184600b0032d8a7c6efcmr579699wri.9.1698946728049; Thu, 02 Nov 2023 10:38:48 -0700 (PDT) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [2001:8b0:1d0::2]) by smtp.gmail.com with ESMTPSA id e16-20020adff350000000b003258934a4bcsm3046805wrp.42.2023.11.02.10.38.47 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 02 Nov 2023 10:38:47 -0700 (PDT) From: Peter Maydell To: qemu-devel@nongnu.org Subject: [PULL 20/33] hw/misc/imx7_snvs: Trace MMIO access Date: Thu, 2 Nov 2023 17:38:22 +0000 Message-Id: <20231102173835.609985-21-peter.maydell@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231102173835.609985-1-peter.maydell@linaro.org> References: <20231102173835.609985-1-peter.maydell@linaro.org> MIME-Version: 1.0 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, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org From: Bernhard Beschow Signed-off-by: Bernhard Beschow Reviewed-by: Philippe Mathieu-Daudé Message-id: 20231028122415.14869-4-shentey@gmail.com Signed-off-by: Peter Maydell --- hw/misc/imx7_snvs.c | 5 +++++ hw/misc/trace-events | 4 ++++ 2 files changed, 9 insertions(+) diff --git a/hw/misc/imx7_snvs.c b/hw/misc/imx7_snvs.c index ee7698bd9cd..a245f96cd4e 100644 --- a/hw/misc/imx7_snvs.c +++ b/hw/misc/imx7_snvs.c @@ -16,9 +16,12 @@ #include "hw/misc/imx7_snvs.h" #include "qemu/module.h" #include "sysemu/runstate.h" +#include "trace.h" static uint64_t imx7_snvs_read(void *opaque, hwaddr offset, unsigned size) { + trace_imx7_snvs_read(offset, 0); + return 0; } @@ -28,6 +31,8 @@ static void imx7_snvs_write(void *opaque, hwaddr offset, const uint32_t value = v; const uint32_t mask = SNVS_LPCR_TOP | SNVS_LPCR_DP_EN; + trace_imx7_snvs_write(offset, value); + if (offset == SNVS_LPCR && ((value & mask) == mask)) { qemu_system_shutdown_request(SHUTDOWN_CAUSE_GUEST_SHUTDOWN); } diff --git a/hw/misc/trace-events b/hw/misc/trace-events index 24ba7cc4d0e..426a8472b69 100644 --- a/hw/misc/trace-events +++ b/hw/misc/trace-events @@ -115,6 +115,10 @@ msf2_sysreg_write_pll_status(void) "Invalid write to read only PLL status regist imx7_gpr_read(uint64_t offset) "addr 0x%08" PRIx64 imx7_gpr_write(uint64_t offset, uint64_t value) "addr 0x%08" PRIx64 "value 0x%08" PRIx64 +# imx7_snvs.c +imx7_snvs_read(uint64_t offset, uint32_t value) "addr 0x%08" PRIx64 "value 0x%08" PRIx32 +imx7_snvs_write(uint64_t offset, uint32_t value) "addr 0x%08" PRIx64 "value 0x%08" PRIx32 + # mos6522.c mos6522_set_counter(int index, unsigned int val) "T%d.counter=%d" mos6522_get_next_irq_time(uint16_t latch, int64_t d, int64_t delta) "latch=%d counter=0x%"PRIx64 " delta_next=0x%"PRIx64 From patchwork Thu Nov 2 17:38:23 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 740448 Delivered-To: patch@linaro.org Received: by 2002:a5d:538f:0:b0:32d:baff:b0ca with SMTP id d15csp961604wrv; Thu, 2 Nov 2023 10:40:09 -0700 (PDT) X-Google-Smtp-Source: AGHT+IETUoYaJpVyIWSJAuq9JA2DSb1879gS+uBjFlhhznhmcDlAN0EnNWPb+qAnSaXNuK2ohKIO X-Received: by 2002:a05:6808:1a0d:b0:3af:a72a:96e2 with SMTP id bk13-20020a0568081a0d00b003afa72a96e2mr22179421oib.7.1698946808835; Thu, 02 Nov 2023 10:40:08 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1698946808; cv=none; d=google.com; s=arc-20160816; b=zNuP3t9Z9WsgQPYKPXGMNxlzxX387WBfuG+xla7CS0zgpkYcl5hF0briP86OXhfRO1 q9S9YHFrOXF3pXwQmDpr7vXeRese759i5YDqM/JLwY73CYviaNt22+1WLboqh59f+m3v P5H/SFuhtkkuXQJW9mMLqE6Va7J+QbhasDPgHn1J1mckgcMMO3QvynZOTlPvyQZ3IQeA DduccKQiah04w2XcSExlA+1e1H6sjAUXv2yGhK9UjrdBtbCnQq/c3kI5HmMrUc530CmW noEo3/pZSfqFwElnnwN9bGRg40NklHvhGNJK+eOfPwtmi/RGr4eUSmhSgxIETc8vk+Fu yckg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:to:from :dkim-signature; bh=yh53+flKs5wwSa/gf36dhongavYBcMPxUgxWx+dgFzI=; fh=PnYt+qEB9tAfMKoqBm2xjKOFpYyFFGPudh5cVIoieJM=; b=ceD538f2Jdb9POy40JY8A8wl2lptyYtQxF6KS8R2FdrzZUUaiV7/jQAupgFZITgu4H fdk0NK+YZ7FO6AFIViU+XwhDkIlx6gFU7vQbeaXG9ga8XKgGb+8iiqOdJtKwQZj/1gkW Ol/XwZAYqwJUbEIftNwK9DwYTs7QR5MzfyFbsfx5a16rZhDBiu6tedqVlQ5tLen0KD9Y IGkfuabGtv17DS5WawzpJaxV/gwLPcOAwxOJz1EPqycP3ePkUuVCGhyTwnVwnBomlVpJ 4oO5XiGlbpxtK12//y2cLUhuptq0Mg2Nk+j/FN7VI/TtE3rOSIYvc+teYcc6aSN5Sku9 aGNw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=HU2uuGkN; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id ro11-20020a05620a398b00b00775a64a819bsi270927qkn.132.2023.11.02.10.40.08 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Thu, 02 Nov 2023 10:40:08 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=HU2uuGkN; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qybfW-0003wG-1v; Thu, 02 Nov 2023 13:39:46 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qybeh-0003H9-SZ for qemu-devel@nongnu.org; Thu, 02 Nov 2023 13:39:00 -0400 Received: from mail-lf1-x129.google.com ([2a00:1450:4864:20::129]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qybec-0002m0-L3 for qemu-devel@nongnu.org; Thu, 02 Nov 2023 13:38:55 -0400 Received: by mail-lf1-x129.google.com with SMTP id 2adb3069b0e04-50939d39d0fso1531719e87.1 for ; Thu, 02 Nov 2023 10:38:49 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1698946728; x=1699551528; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:from:to:cc:subject:date:message-id :reply-to; bh=yh53+flKs5wwSa/gf36dhongavYBcMPxUgxWx+dgFzI=; b=HU2uuGkNOc0/fmjvXYm/8xop5QF+EzXJp1DoIUaZvVAftfKpTGdkqr8ok+9A2SzQRN CYA0O1PRFf5BgWWcwApPck2P0OtRbXFXGti9+vbZuMg5FuSr9wJIJfJLEMIcXWHRj5YB TkaD69G3vAHzhvv/XQX7lkfEynEySosvHB9ufhDzdRJQ0CsqCL1AISMgEvO+jyPofNLa tOviSZCrZ8uPNB6y3vPpUCUXq0chrOMdphAPJVlx5T9b4PUD8tmDAjPSngmFMLRR+WsD FlhW5jSuUuDt9bttIaEu5IA0Ph3BBZE0Kdr4W9ZV5CDOqK65MN5z10pRu/aqnNF3O7K+ RK2A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1698946728; x=1699551528; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=yh53+flKs5wwSa/gf36dhongavYBcMPxUgxWx+dgFzI=; b=RIxGOkswDwFaBEMEzCvbnovvn8sEXOnZ9sO04gOx3g9OVHzM97VmS9Bowpzu4q6MpR DhqomHhxVMllUn/ehW4wC480YSRSBq/zR2u3QpFfx9w3dMetrZdQrCBkxx0ZYsKgnd18 HFnf309sP9twVDITDfRGG6zxz3uM/68bbPhTXKnc6XWoiCC8htOxOg+dokY2tw8ciMls rHMMSnm4uEohdGcgoa8ijoUPyFSJmmx8NrW9mUIL6mTWwKgdzTCVBcDH/G8FV2Qg5YD0 S+C3hHn1ITfAwTfk14SR1OfEWeJJmBM850SauYImS0OEaWIJn7/1Mbtafrj7CEnGNDpm QYZw== X-Gm-Message-State: AOJu0YyGlidES8qTWsp/+f8Q/8l7YJG+2inf6f46eIqhNNi9vSqEhWpg Pu9iQFyiS8baWZzQ4bPFSr9UxNtKCJCIMDlyOPA= X-Received: by 2002:a05:6512:2037:b0:507:a1b3:2d47 with SMTP id s23-20020a056512203700b00507a1b32d47mr14290036lfs.17.1698946728482; Thu, 02 Nov 2023 10:38:48 -0700 (PDT) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [2001:8b0:1d0::2]) by smtp.gmail.com with ESMTPSA id e16-20020adff350000000b003258934a4bcsm3046805wrp.42.2023.11.02.10.38.48 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 02 Nov 2023 10:38:48 -0700 (PDT) From: Peter Maydell To: qemu-devel@nongnu.org Subject: [PULL 21/33] hw/misc/imx6_ccm: Convert DPRINTF to trace events Date: Thu, 2 Nov 2023 17:38:23 +0000 Message-Id: <20231102173835.609985-22-peter.maydell@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231102173835.609985-1-peter.maydell@linaro.org> References: <20231102173835.609985-1-peter.maydell@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::129; envelope-from=peter.maydell@linaro.org; helo=mail-lf1-x129.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, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org From: Bernhard Beschow Signed-off-by: Bernhard Beschow Reviewed-by: Philippe Mathieu-Daudé Message-id: 20231028122415.14869-5-shentey@gmail.com [PMM: Add "Hz" unit indicator to frequency traces] Signed-off-by: Peter Maydell --- hw/misc/imx6_ccm.c | 41 ++++++++++++++--------------------------- hw/misc/trace-events | 15 +++++++++++++++ 2 files changed, 29 insertions(+), 27 deletions(-) diff --git a/hw/misc/imx6_ccm.c b/hw/misc/imx6_ccm.c index 4c830fd89ae..85af466c2be 100644 --- a/hw/misc/imx6_ccm.c +++ b/hw/misc/imx6_ccm.c @@ -15,18 +15,7 @@ #include "migration/vmstate.h" #include "qemu/log.h" #include "qemu/module.h" - -#ifndef DEBUG_IMX6_CCM -#define DEBUG_IMX6_CCM 0 -#endif - -#define DPRINTF(fmt, args...) \ - do { \ - if (DEBUG_IMX6_CCM) { \ - fprintf(stderr, "[%s]%s: " fmt , TYPE_IMX6_CCM, \ - __func__, ##args); \ - } \ - } while (0) +#include "trace.h" static const char *imx6_ccm_reg_name(uint32_t reg) { @@ -263,7 +252,7 @@ static uint64_t imx6_analog_get_pll2_clk(IMX6CCMState *dev) freq *= 20; } - DPRINTF("freq = %u\n", (uint32_t)freq); + trace_imx6_analog_get_pll2_clk(freq); return freq; } @@ -275,7 +264,7 @@ static uint64_t imx6_analog_get_pll2_pfd0_clk(IMX6CCMState *dev) freq = imx6_analog_get_pll2_clk(dev) * 18 / EXTRACT(dev->analog[CCM_ANALOG_PFD_528], PFD0_FRAC); - DPRINTF("freq = %u\n", (uint32_t)freq); + trace_imx6_analog_get_pll2_pfd0_clk(freq); return freq; } @@ -287,7 +276,7 @@ static uint64_t imx6_analog_get_pll2_pfd2_clk(IMX6CCMState *dev) freq = imx6_analog_get_pll2_clk(dev) * 18 / EXTRACT(dev->analog[CCM_ANALOG_PFD_528], PFD2_FRAC); - DPRINTF("freq = %u\n", (uint32_t)freq); + trace_imx6_analog_get_pll2_pfd2_clk(freq); return freq; } @@ -315,7 +304,7 @@ static uint64_t imx6_analog_get_periph_clk(IMX6CCMState *dev) break; } - DPRINTF("freq = %u\n", (uint32_t)freq); + trace_imx6_analog_get_periph_clk(freq); return freq; } @@ -327,7 +316,7 @@ static uint64_t imx6_ccm_get_ahb_clk(IMX6CCMState *dev) freq = imx6_analog_get_periph_clk(dev) / (1 + EXTRACT(dev->ccm[CCM_CBCDR], AHB_PODF)); - DPRINTF("freq = %u\n", (uint32_t)freq); + trace_imx6_ccm_get_ahb_clk(freq); return freq; } @@ -339,7 +328,7 @@ static uint64_t imx6_ccm_get_ipg_clk(IMX6CCMState *dev) freq = imx6_ccm_get_ahb_clk(dev) / (1 + EXTRACT(dev->ccm[CCM_CBCDR], IPG_PODF)); - DPRINTF("freq = %u\n", (uint32_t)freq); + trace_imx6_ccm_get_ipg_clk(freq); return freq; } @@ -351,7 +340,7 @@ static uint64_t imx6_ccm_get_per_clk(IMX6CCMState *dev) freq = imx6_ccm_get_ipg_clk(dev) / (1 + EXTRACT(dev->ccm[CCM_CSCMR1], PERCLK_PODF)); - DPRINTF("freq = %u\n", (uint32_t)freq); + trace_imx6_ccm_get_per_clk(freq); return freq; } @@ -385,7 +374,7 @@ static uint32_t imx6_ccm_get_clock_frequency(IMXCCMState *dev, IMXClk clock) break; } - DPRINTF("Clock = %d) = %u\n", clock, freq); + trace_imx6_ccm_get_clock_frequency(clock, freq); return freq; } @@ -394,7 +383,7 @@ static void imx6_ccm_reset(DeviceState *dev) { IMX6CCMState *s = IMX6_CCM(dev); - DPRINTF("\n"); + trace_imx6_ccm_reset(); s->ccm[CCM_CCR] = 0x040116FF; s->ccm[CCM_CCDR] = 0x00000000; @@ -483,7 +472,7 @@ static uint64_t imx6_ccm_read(void *opaque, hwaddr offset, unsigned size) value = s->ccm[index]; - DPRINTF("reg[%s] => 0x%" PRIx32 "\n", imx6_ccm_reg_name(index), value); + trace_imx6_ccm_read(imx6_ccm_reg_name(index), value); return (uint64_t)value; } @@ -494,8 +483,7 @@ static void imx6_ccm_write(void *opaque, hwaddr offset, uint64_t value, uint32_t index = offset >> 2; IMX6CCMState *s = (IMX6CCMState *)opaque; - DPRINTF("reg[%s] <= 0x%" PRIx32 "\n", imx6_ccm_reg_name(index), - (uint32_t)value); + trace_imx6_ccm_write(imx6_ccm_reg_name(index), (uint32_t)value); /* * We will do a better implementation later. In particular some bits @@ -591,7 +579,7 @@ static uint64_t imx6_analog_read(void *opaque, hwaddr offset, unsigned size) break; } - DPRINTF("reg[%s] => 0x%" PRIx32 "\n", imx6_analog_reg_name(index), value); + trace_imx6_analog_read(imx6_analog_reg_name(index), value); return (uint64_t)value; } @@ -602,8 +590,7 @@ static void imx6_analog_write(void *opaque, hwaddr offset, uint64_t value, uint32_t index = offset >> 2; IMX6CCMState *s = (IMX6CCMState *)opaque; - DPRINTF("reg[%s] <= 0x%" PRIx32 "\n", imx6_analog_reg_name(index), - (uint32_t)value); + trace_imx6_analog_write(imx6_analog_reg_name(index), (uint32_t)value); switch (index) { case CCM_ANALOG_PLL_ARM_SET: diff --git a/hw/misc/trace-events b/hw/misc/trace-events index 426a8472b69..05ff692441b 100644 --- a/hw/misc/trace-events +++ b/hw/misc/trace-events @@ -196,6 +196,21 @@ iotkit_secctl_s_write(uint32_t offset, uint64_t data, unsigned size) "IoTKit Sec iotkit_secctl_ns_read(uint32_t offset, uint64_t data, unsigned size) "IoTKit SecCtl NS regs read: offset 0x%x data 0x%" PRIx64 " size %u" iotkit_secctl_ns_write(uint32_t offset, uint64_t data, unsigned size) "IoTKit SecCtl NS regs write: offset 0x%x data 0x%" PRIx64 " size %u" +# imx6_ccm.c +imx6_analog_get_periph_clk(uint32_t freq) "freq = %u Hz" +imx6_analog_get_pll2_clk(uint32_t freq) "freq = %u Hz" +imx6_analog_get_pll2_pfd0_clk(uint32_t freq) "freq = %u Hz" +imx6_analog_get_pll2_pfd2_clk(uint32_t freq) "freq = %u Hz" +imx6_analog_read(const char *reg, uint32_t value) "reg[%s] => 0x%" PRIx32 +imx6_analog_write(const char *reg, uint32_t value) "reg[%s] <= 0x%" PRIx32 +imx6_ccm_get_ahb_clk(uint32_t freq) "freq = %u Hz" +imx6_ccm_get_ipg_clk(uint32_t freq) "freq = %u Hz" +imx6_ccm_get_per_clk(uint32_t freq) "freq = %u Hz" +imx6_ccm_get_clock_frequency(unsigned clock, uint32_t freq) "(Clock = %d) = %u" +imx6_ccm_read(const char *reg, uint32_t value) "reg[%s] => 0x%" PRIx32 +imx6_ccm_reset(void) "" +imx6_ccm_write(const char *reg, uint32_t value) "reg[%s] <= 0x%" PRIx32 + # imx6ul_ccm.c ccm_entry(void) "" ccm_freq(uint32_t freq) "freq = %d" From patchwork Thu Nov 2 17:38:24 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 740455 Delivered-To: patch@linaro.org Received: by 2002:a5d:538f:0:b0:32d:baff:b0ca with SMTP id d15csp962028wrv; Thu, 2 Nov 2023 10:41:09 -0700 (PDT) X-Google-Smtp-Source: AGHT+IEXBDznI4noqX2+l63+JqRhXM0A4wHGP2Q0Bg/iuFpawH4sL1+3inAX+L5Mr6cp5L3lqadm X-Received: by 2002:a05:690c:5:b0:59c:aea:d877 with SMTP id bc5-20020a05690c000500b0059c0aead877mr523235ywb.40.1698946869081; Thu, 02 Nov 2023 10:41:09 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1698946869; cv=none; d=google.com; s=arc-20160816; b=mUjcCQPOmqwd01RJFEguSKJD5APOIe2MYDYMFv3hbv3Fb77qLm+gLwINBEr671fi9V ewwdvzHcEhgnYQiLsTmpl9qALkWGzl47p3e7qkGczedpwQl7+fvFVQKT1n1Swk2W+DRa KyBpuJDrP9kPqXOO/WLIp3kdeu9tCszVR+UITshlOlZn7bq+waeMYJdRqhZainbOSAqb UZFwMzYHK+CFJ4QaunWJGNbYsf+92jhzXU/B4P7gEbhUCyqPKXgS1DNNqiXKFuKk938A AxBt28mP02lFxoTV2E+91cnodg/uryZ4l+A3EIQwUdEAaANl4JtdO6SMupZRHJrMn+vB 8QPA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:to:from :dkim-signature; bh=+OgurXglUm5DGvPAaUaiEGoa0h4kT2MTfg7/wu2rdFc=; fh=PnYt+qEB9tAfMKoqBm2xjKOFpYyFFGPudh5cVIoieJM=; b=ZHDPNX802foR/50mB3oyBv/8R5SQ4cLQ2e+YpuDWZPZ6LsWzQXMuAsC/u5Th4Q0ejV HfqNhGRv2mkjujCk8hkD9G7adt01GKBPg1rzgy5gSH2OXzJZTVEGBJmGen8M6+gutSkc fA7nzalTzgg4ogVNO+oGTiihzTn7Y1OVrRmIw00u3FyH6/ZwO7Vviwqj6xpvsoqyK4jV IhQlPN6Lve7u4wWpXeg5R4F7emIXVBAJTFoHbBMz2dVlgCPWS8YL6/weP5F96Z2c8tSv eQhe5obcKBNsMqA72uF1dq/gdRv6hI0NMcSH1JPJlpHW+mg2OagskZE84kTHhTOnUtDG tivw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=aPM6Wyqx; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id dj20-20020a056214091400b0065b1c33dfcfsi270992qvb.352.2023.11.02.10.41.08 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Thu, 02 Nov 2023 10:41:09 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=aPM6Wyqx; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qybfo-000474-4N; Thu, 02 Nov 2023 13:40:07 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qybeh-0003H6-LE for qemu-devel@nongnu.org; Thu, 02 Nov 2023 13:38:59 -0400 Received: from mail-wr1-x42b.google.com ([2a00:1450:4864:20::42b]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qybec-0002mB-LB for qemu-devel@nongnu.org; Thu, 02 Nov 2023 13:38:55 -0400 Received: by mail-wr1-x42b.google.com with SMTP id ffacd0b85a97d-32f737deedfso699164f8f.3 for ; Thu, 02 Nov 2023 10:38:50 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1698946729; x=1699551529; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:from:to:cc:subject:date:message-id :reply-to; bh=+OgurXglUm5DGvPAaUaiEGoa0h4kT2MTfg7/wu2rdFc=; b=aPM6WyqxyAB3A2/cX1OZIXu8YhIrzjUqluc/331q+8mp+3aQBUFRi0PqeYrXySMEMJ 6/uCrp3WFy/4aueQq1PLSFOfk3GtBC1Go1pQHffjeDz5o8oCIbYjhvaG7eRbja3QB108 26ZlTSkf6a/OaxhgWjVsypsWhTHP+ag7MVG4FPxvtfCBOccFaJWTLfgGhqfcivaaI3P8 c4GoF2GPNzmr+uckS9Rpyy2cbnDUb2rt9umWucNtuNqFcuNyXbA9FVShWfcjN/M6XJ+H +1Cij6bTcuETK05yCQcDm1gVHKNemgvzXxcqA4looWdNhYjF6TIsWxIgs4My9MhPchwj I2RA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1698946729; x=1699551529; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=+OgurXglUm5DGvPAaUaiEGoa0h4kT2MTfg7/wu2rdFc=; b=A3epxJ8gMSc0qeslYGj0FveFUWVGDOgM/JyquDZVbnqDj9v13PQ1AnPhKbsrHvCwPQ 3slYMB3uf7Z9fOHV14I/KOCMx8ylscD3Wav/0h+/age0AakBXZsL0+KetT3YOCT1E8lw BEt1ym9Z/YgM4QHxdaOROKbmm44F2APkYhMhit1ADLKWB0IbvfNMSQaGQHuDMks99GVr y18u18IoidQUhyzkFiAMGh/BxGESfLJmaEtFydTExgNe0VQi1WPfSKqFWEmIi7g7dA0J 7/zivF8NsyxuWQpSjBqS9UpDWrlSXwspKneRWCo0vM4sIBoUNYWhz0ExiSgd7YgFSDnq eYaQ== X-Gm-Message-State: AOJu0Yw5WzAbCHGBGca/0davQsTk/+UsBBCYE4nskZ9iU7qSEVesm0G2 ajsQ+yh7WtqLV9ofv118LOTi0AcS/DR5Ig51S2Y= X-Received: by 2002:a05:6000:154a:b0:32f:7bd7:9f1d with SMTP id 10-20020a056000154a00b0032f7bd79f1dmr13127798wry.48.1698946728947; Thu, 02 Nov 2023 10:38:48 -0700 (PDT) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [2001:8b0:1d0::2]) by smtp.gmail.com with ESMTPSA id e16-20020adff350000000b003258934a4bcsm3046805wrp.42.2023.11.02.10.38.48 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 02 Nov 2023 10:38:48 -0700 (PDT) From: Peter Maydell To: qemu-devel@nongnu.org Subject: [PULL 22/33] hw/i2c/pm_smbus: Convert DPRINTF to trace events Date: Thu, 2 Nov 2023 17:38:24 +0000 Message-Id: <20231102173835.609985-23-peter.maydell@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231102173835.609985-1-peter.maydell@linaro.org> References: <20231102173835.609985-1-peter.maydell@linaro.org> MIME-Version: 1.0 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, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org From: Bernhard Beschow Let the trace messages slightly deviate from the function names ("smb" -> "smbus") being traced in order to avoid conflights with the SMB protocol. Signed-off-by: Bernhard Beschow Reviewed-by: Philippe Mathieu-Daudé Acked-by: Corey Minyard Message-id: 20231028122415.14869-6-shentey@gmail.com Signed-off-by: Peter Maydell --- hw/i2c/pm_smbus.c | 18 ++++-------------- hw/i2c/trace-events | 6 ++++++ 2 files changed, 10 insertions(+), 14 deletions(-) diff --git a/hw/i2c/pm_smbus.c b/hw/i2c/pm_smbus.c index 4e1b8a5182d..78e7c229a85 100644 --- a/hw/i2c/pm_smbus.c +++ b/hw/i2c/pm_smbus.c @@ -23,6 +23,7 @@ #include "hw/i2c/pm_smbus.h" #include "hw/i2c/smbus_master.h" #include "migration/vmstate.h" +#include "trace.h" #define SMBHSTSTS 0x00 #define SMBHSTCNT 0x02 @@ -64,15 +65,6 @@ #define AUX_BLK (1 << 1) #define AUX_MASK 0x3 -/*#define DEBUG*/ - -#ifdef DEBUG -# define SMBUS_DPRINTF(format, ...) printf(format, ## __VA_ARGS__) -#else -# define SMBUS_DPRINTF(format, ...) do { } while (0) -#endif - - static void smb_transaction(PMSMBus *s) { uint8_t prot = (s->smb_ctl >> 2) & 0x07; @@ -82,7 +74,7 @@ static void smb_transaction(PMSMBus *s) I2CBus *bus = s->smbus; int ret; - SMBUS_DPRINTF("SMBus trans addr=0x%02x prot=0x%02x\n", addr, prot); + trace_smbus_transaction(addr, prot); /* Transaction isn't exec if STS_DEV_ERR bit set */ if ((s->smb_stat & STS_DEV_ERR) != 0) { goto error; @@ -258,8 +250,7 @@ static void smb_ioport_writeb(void *opaque, hwaddr addr, uint64_t val, PMSMBus *s = opaque; uint8_t clear_byte_done; - SMBUS_DPRINTF("SMB writeb port=0x%04" HWADDR_PRIx - " val=0x%02" PRIx64 "\n", addr, val); + trace_smbus_ioport_writeb(addr, val); switch(addr) { case SMBHSTSTS: clear_byte_done = s->smb_stat & val & STS_BYTE_DONE; @@ -429,8 +420,7 @@ static uint64_t smb_ioport_readb(void *opaque, hwaddr addr, unsigned width) val = 0; break; } - SMBUS_DPRINTF("SMB readb port=0x%04" HWADDR_PRIx " val=0x%02x\n", - addr, val); + trace_smbus_ioport_readb(addr, val); if (s->set_irq) { s->set_irq(s, smb_irq_value(s)); diff --git a/hw/i2c/trace-events b/hw/i2c/trace-events index d7b1e25858b..6900e06edad 100644 --- a/hw/i2c/trace-events +++ b/hw/i2c/trace-events @@ -15,6 +15,12 @@ i2c_send_async(uint8_t address, uint8_t data) "send_async(addr:0x%02x) data:0x%0 i2c_recv(uint8_t address, uint8_t data) "recv(addr:0x%02x) data:0x%02x" i2c_ack(void) "" +# pm_smbus.c + +smbus_ioport_readb(uint16_t addr, uint8_t data) "[0x%04" PRIx16 "] -> val=0x%02x" +smbus_ioport_writeb(uint16_t addr, uint8_t data) "[0x%04" PRIx16 "] <- val=0x%02x" +smbus_transaction(uint8_t addr, uint8_t prot) "addr=0x%02x prot=0x%02x" + # allwinner_i2c.c allwinner_i2c_read(const char* reg_name, uint64_t offset, uint64_t value) "read %s [0x%" PRIx64 "]: -> 0x%" PRIx64 From patchwork Thu Nov 2 17:38:25 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 740460 Delivered-To: patch@linaro.org Received: by 2002:a5d:538f:0:b0:32d:baff:b0ca with SMTP id d15csp962140wrv; Thu, 2 Nov 2023 10:41:22 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGNS14mX1LqGZgLeMbmoNeBwNBSEyI6I4vJp/yZiF1NCRtqdLx37is5yQqNAssblBvte1tG X-Received: by 2002:a05:6808:f8e:b0:3a8:1c07:17d3 with SMTP id o14-20020a0568080f8e00b003a81c0717d3mr24986127oiw.19.1698946881795; Thu, 02 Nov 2023 10:41:21 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1698946881; cv=none; d=google.com; s=arc-20160816; b=bPsKklpd2HWA4n0a12qjdTirrGSEzYTcX4Qe/wdxh4d/GEaLia/paMVwKdcsA1p9JV y3VvFN3o2awCd9Wc8ORzI+hmXVpYZR9EW8ZtvZRXDvW855hwVNnrguEW8Xj0d3EfmH1q deVvGa2TYLyplPF+bfENtgzciZZHhvO5Lq6dwIpJ81bP2XF6hPYy7ymvlLxW1wA+IzwC BchUGac+5TJKvug6ZYBGwvtCR/iAbU6XSZKspojZzbnobV6mrq0lun1+osA9MDTDf/G3 g7XHDbrtxeTMFlUOt7lTEq0eZJ1jFcdi7XIFsd+rZfsRAttQB4Eb6JgW5K/URdba1GSt urzQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:to:from :dkim-signature; bh=5gnjJmQvTJBwOrKE2T0p6/jD0OcYtl+uj21k3TqiHP4=; fh=PnYt+qEB9tAfMKoqBm2xjKOFpYyFFGPudh5cVIoieJM=; b=PI/FQBCh/szL5pT4hci1Wn1cBtYMkD4K0GOWYCUOsfSap5jxkiGqmnHCHno4KMUbju oGb3QfoWcAKr4AIUN3DWcsY4vBWX2nvByYY98MkB2pGcs0wUPfwRpNYfAA1BI+RCxa+K 6gXlYZTng47qLY5rbJPhYuETxl4orDw9HntmW0A9cqDwTg6cUSQsxDWPGRw0SYHHseWF mfaa4jT1oSZJ0cZ4PNqdHUZBRtuBDK5bRn/7ce4eyLCDmlU0umr3KsSopIkEIxYi6Q4M Fx0+m2v4P9WO0d0dDemGx70/wWb5DZl5Emrlb6ks8/aI7mCpswYvEC+BvfUSV0ltwsMw ezSA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=FTOQrp86; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id x20-20020a05620a449400b00765ad3da644si279333qkp.600.2023.11.02.10.41.21 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Thu, 02 Nov 2023 10:41:21 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=FTOQrp86; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qybfo-000473-4a; Thu, 02 Nov 2023 13:40:07 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qybeh-0003H5-KL for qemu-devel@nongnu.org; Thu, 02 Nov 2023 13:38:58 -0400 Received: from mail-wr1-x42a.google.com ([2a00:1450:4864:20::42a]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qybec-0002mF-NV for qemu-devel@nongnu.org; Thu, 02 Nov 2023 13:38:55 -0400 Received: by mail-wr1-x42a.google.com with SMTP id ffacd0b85a97d-32fa7d15f4eso724855f8f.3 for ; Thu, 02 Nov 2023 10:38:50 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1698946729; x=1699551529; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:from:to:cc:subject:date:message-id :reply-to; bh=5gnjJmQvTJBwOrKE2T0p6/jD0OcYtl+uj21k3TqiHP4=; b=FTOQrp86S3Zn9+lavvvIfFk70WzcilcwNEREHrSWcZPXsPFX/FY8OdFlphBoIo7MO/ RAYCuXncBVcDklEcbOM+E7w/5RD2zmjw9iXE4pn711gsd4AABdOv+hfEI9/YmM2iUSx6 W5vRqAgseG4mLFyZFK1o38IMWbX9WLT6SNeXvvzf8Jmp8nzFXGIZ+8hoPpge+nwVdWF/ 27sZ/wdRssd90JnIkOJ5q2MTgV4jeLdM3A+H6msIfe/+gOrqfJFQ9ocT2kpFxVhJGHjx W577gsyRDyrhAwLku0+OvIp2/BRX0rr6N0tJEnY5BMJlBvKz5vbk7wEqxNyuUh4iuSK6 naHA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1698946729; x=1699551529; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=5gnjJmQvTJBwOrKE2T0p6/jD0OcYtl+uj21k3TqiHP4=; b=UPBp2JK3UaaqVzVDXSc9NWfZUXDkE+5hw2kvsTBGRFU3ZkBRF+Utg+9JTiWlxahuPi 2IDoawyPYDBx7bgw9oRIENIIPVIAj0j/5V4yKxQoC7e4a3/0ORICmUj8TlAwBSj8ZYxs l4nHfuLDGycoVq+V02Mq6ARe153q+KP0tioG0f1a7sN3Cb3czRxjY5KL7fjIbFqseDqk 53tB2VKvQXcdFVgxU3wJL9epbi7Qsf2cJCd8rFIpl/0zB8tnJnvAkg7X0vpK4vikjOQ6 gmS6RvDMM3migyYpOlMFuS8kkWKQGmffzBd/sgPUU6a8Vyl/KiUO/SVOKN0KljnzTBEE LZxQ== X-Gm-Message-State: AOJu0YzFtpW1Bzl224KHBNFPcwyS7MZZBHSU2swtEkyKFOoms3Zn1rEF TMYZPQqclMM/v/X0pyXwgfo8ayBLm3AkGijs2pc= X-Received: by 2002:a05:6000:156d:b0:32f:7db1:22fe with SMTP id 13-20020a056000156d00b0032f7db122femr15023632wrz.15.1698946729384; Thu, 02 Nov 2023 10:38:49 -0700 (PDT) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [2001:8b0:1d0::2]) by smtp.gmail.com with ESMTPSA id e16-20020adff350000000b003258934a4bcsm3046805wrp.42.2023.11.02.10.38.49 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 02 Nov 2023 10:38:49 -0700 (PDT) From: Peter Maydell To: qemu-devel@nongnu.org Subject: [PULL 23/33] target/arm: Enable FEAT_MOPS insns in user-mode emulation Date: Thu, 2 Nov 2023 17:38:25 +0000 Message-Id: <20231102173835.609985-24-peter.maydell@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231102173835.609985-1-peter.maydell@linaro.org> References: <20231102173835.609985-1-peter.maydell@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::42a; envelope-from=peter.maydell@linaro.org; helo=mail-wr1-x42a.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, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org In user-mode emulation, we need to set the SCTLR_EL1.MSCEn bit to avoid all the FEAT_MOPS insns UNDEFing. Signed-off-by: Peter Maydell Reviewed-by: Richard Henderson Message-id: 20231030174000.3792225-2-peter.maydell@linaro.org --- target/arm/cpu.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/target/arm/cpu.c b/target/arm/cpu.c index 954328d72a0..df6496b0193 100644 --- a/target/arm/cpu.c +++ b/target/arm/cpu.c @@ -296,6 +296,8 @@ static void arm_cpu_reset_hold(Object *obj) env->cp15.sctlr_el[1] |= SCTLR_TSCXT; /* Disable access to Debug Communication Channel (DCC). */ env->cp15.mdscr_el1 |= 1 << 12; + /* Enable FEAT_MOPS */ + env->cp15.sctlr_el[1] |= SCTLR_MSCEN; #else /* Reset into the highest available EL */ if (arm_feature(env, ARM_FEATURE_EL3)) { From patchwork Thu Nov 2 17:38:26 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 740478 Delivered-To: patch@linaro.org Received: by 2002:a5d:538f:0:b0:32d:baff:b0ca with SMTP id d15csp964530wrv; Thu, 2 Nov 2023 10:47:06 -0700 (PDT) X-Google-Smtp-Source: AGHT+IF1eqyyZDhjvHEU0rqwfjiSA4ENjyNT9xM5vXm+D1+N/DzE4ee790SNmDmoFAEQJ/B5fZgy X-Received: by 2002:a05:600c:4f92:b0:401:a0b1:aef6 with SMTP id n18-20020a05600c4f9200b00401a0b1aef6mr16469619wmq.2.1698947226405; Thu, 02 Nov 2023 10:47:06 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1698947226; cv=none; d=google.com; s=arc-20160816; b=Vkr++Yj8jsqOdiwWlBBJYTsHSlOUMza+v0uluemtG072HluqS/DhlHKFvaitvJM3mi YDlRGdXc89YEh7o3Sz5Qn8dr1kuvcfUTCZdGhDx91lP7Bp+DVPhqYsUY1O+/OB8pTA5T a8qRmM01wW1DNK5/ZRdWhEkTRHzBj6I9D6mNqIHB3loj+f/7gWvpxjyOOZuxbBrWaKLK mDSxzpg2Ig9PQcEVfuAa5Me5MjS0cE6vJ+OyzZKNO3Rby/0wBLWadTuM3Mxkiyevghk8 wkMWKbeBfr7wYnDbU/Bcg9VejUMuDtWDuTuPRQ7Zn9Gq0onmMPBGy1gSZO+vYMetLDvK k0Gg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:to:from :dkim-signature; bh=KvWivuRtwwwvha4YHNrmTGvIkSjxbhYcjuu+AWQQ3Q0=; fh=PnYt+qEB9tAfMKoqBm2xjKOFpYyFFGPudh5cVIoieJM=; b=c1ZZc10kcr9pCWtHDYNIqqZyBwknnpeDUMJA/o/laRVwUWYrF4tDylPCdRAGm4luAn hsJPdvKgbTxlqyMbV/OiZYi+WxEsJD62ifNdMLHbt/q+ycc+b9n9QROD2V8Jk/iBoaB3 o7hphuHVkMQpxOJlvhrbOgv6fhzsUTE63cqVtrgfEGN3V9jCv8vxe8mZOXk54vw6AqfU ObIncwHcArE92NBtXwrewiLXTDpBlj7/CjROkGEz9TCbL7suXfaS8bSusNJ0BMKYOuTY dY/G//DKZR1YvBKUvJ/tOLRLLSbQHs8wtgppZkK0z4zYdhxNMBUBpvOkvLZEZiPDlljI cpTA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=TBt8No7y; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id l9-20020a05600002a900b0032d849f6204si1959367wry.37.2023.11.02.10.47.06 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Thu, 02 Nov 2023 10:47:06 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=TBt8No7y; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qybfO-0003l4-12; Thu, 02 Nov 2023 13:39:38 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qybeh-0003H8-OM for qemu-devel@nongnu.org; Thu, 02 Nov 2023 13:38:59 -0400 Received: from mail-wm1-x331.google.com ([2a00:1450:4864:20::331]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qybed-0002pq-EK for qemu-devel@nongnu.org; Thu, 02 Nov 2023 13:38:55 -0400 Received: by mail-wm1-x331.google.com with SMTP id 5b1f17b1804b1-4079ed65582so9470815e9.1 for ; Thu, 02 Nov 2023 10:38:50 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1698946730; x=1699551530; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:from:to:cc:subject:date:message-id :reply-to; bh=KvWivuRtwwwvha4YHNrmTGvIkSjxbhYcjuu+AWQQ3Q0=; b=TBt8No7ybyc+cpj3PYpbLojzVQpoZXIl1qLCvJnHkCWoQHqTl9iHSoiJkvxgIuKBzY d5epeotaxEvidTOYjzuCB7YIwLVkdLEz7iIUXSEFzcTQnKNlPBgpaQcksLHYZI6C+UW3 bnC9yM6MPxf2AbGsvndxKb5KQFx6a9X1pvURT7xapMTVtnl7dx+L9AUf/ill5R2UwrVL OVMb/hY14MGPkjTn+cDcagXClJ4D14B1bB91INGnqCrHly8nixpLFQfHExAY0x14bLds fkW7nJ8Q5hEIL4kgSRPtqAPJK3wpWGKW1VTTXDJrjQOLQzzKLc5evZDZ8tFR3Q3UqKjY nA8A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1698946730; x=1699551530; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=KvWivuRtwwwvha4YHNrmTGvIkSjxbhYcjuu+AWQQ3Q0=; b=Xr/SNfkX5qlwAdgBWK/20yHiHTeeppdS3di8+pX3+svmR95+WH4a+UE9b0uUbQ/sDG t5i701bkBEwSJDfB1tUoeIxtWhvo8jBEGg/vMihY8M2KISnyacrZH9NOM5ntdL6vlYaZ U2lfJpDYJ7dVwdLnocSQEyf2h+56fDLPGu1UaAfAqBbH9cVnm8o1e4tKhBvajgh6qHeR v8MXKxYdNU/fqhpkByXkMSE9sCEbotf4rTvJ3llxVR4/Z0rZMB4ewZUFpiQVkkL/kphy QSHKl8YouQebLh3qs8vhLC+xarp7SuBebMZEQFuhA1I1G9H9wyq15J2KSBvOkUg0HJer mN8Q== X-Gm-Message-State: AOJu0YzOGB0Lr8/XgIdb5K5h8yaajfcVtryZNdEDtMMYtz8Rv8UvkXOO n5/aJFAXWQAbsL/Q6gqZeDF+EMelqZix979qSS8= X-Received: by 2002:adf:f211:0:b0:32d:a7b0:62b with SMTP id p17-20020adff211000000b0032da7b0062bmr12903123wro.26.1698946730007; Thu, 02 Nov 2023 10:38:50 -0700 (PDT) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [2001:8b0:1d0::2]) by smtp.gmail.com with ESMTPSA id e16-20020adff350000000b003258934a4bcsm3046805wrp.42.2023.11.02.10.38.49 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 02 Nov 2023 10:38:49 -0700 (PDT) From: Peter Maydell To: qemu-devel@nongnu.org Subject: [PULL 24/33] linux-user: Report AArch64 hwcap2 fields above bit 31 Date: Thu, 2 Nov 2023 17:38:26 +0000 Message-Id: <20231102173835.609985-25-peter.maydell@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231102173835.609985-1-peter.maydell@linaro.org> References: <20231102173835.609985-1-peter.maydell@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::331; envelope-from=peter.maydell@linaro.org; helo=mail-wm1-x331.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, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org The AArch64 ELF hwcap2 field is 64 bits, but our get_elf_hwcap2() works with uint32_t, so it accidentally fails to report any hwcaps over bit 31. Use uint64_t here. The Arm hwcap2 is only 32 bits (because the ELF format makes these fields be the size of "long" in the ABI), but since it shares the prototype declaration for get_elf_hwcap2() it is easier to also expand it to 64 bits. The only hwcap fields we implement already that are affected by this are the HBC and MOPS ones, neither of which were implemented in a previous release, so this doesn't need backporting to older stable branches. Signed-off-by: Peter Maydell Reviewed-by: Richard Henderson Reviewed-by: Philippe Mathieu-Daudé Message-id: 20231030174000.3792225-3-peter.maydell@linaro.org --- linux-user/loader.h | 2 +- linux-user/elfload.c | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/linux-user/loader.h b/linux-user/loader.h index a0834290e7d..e102e6f4108 100644 --- a/linux-user/loader.h +++ b/linux-user/loader.h @@ -103,7 +103,7 @@ uint32_t get_elf_hwcap(void); const char *elf_hwcap_str(uint32_t bit); #endif #if defined(TARGET_AARCH64) || defined(TARGET_ARM) -uint32_t get_elf_hwcap2(void); +uint64_t get_elf_hwcap2(void); const char *elf_hwcap2_str(uint32_t bit); #endif diff --git a/linux-user/elfload.c b/linux-user/elfload.c index 3f3975352af..4cd6891d7b6 100644 --- a/linux-user/elfload.c +++ b/linux-user/elfload.c @@ -552,10 +552,10 @@ uint32_t get_elf_hwcap(void) return hwcaps; } -uint32_t get_elf_hwcap2(void) +uint64_t get_elf_hwcap2(void) { ARMCPU *cpu = ARM_CPU(thread_cpu); - uint32_t hwcaps = 0; + uint64_t hwcaps = 0; GET_FEATURE_ID(aa32_aes, ARM_HWCAP2_ARM_AES); GET_FEATURE_ID(aa32_pmull, ARM_HWCAP2_ARM_PMULL); @@ -818,10 +818,10 @@ uint32_t get_elf_hwcap(void) return hwcaps; } -uint32_t get_elf_hwcap2(void) +uint64_t get_elf_hwcap2(void) { ARMCPU *cpu = ARM_CPU(thread_cpu); - uint32_t hwcaps = 0; + uint64_t hwcaps = 0; GET_FEATURE_ID(aa64_dcpodp, ARM_HWCAP2_A64_DCPODP); GET_FEATURE_ID(aa64_sve2, ARM_HWCAP2_A64_SVE2); From patchwork Thu Nov 2 17:38:27 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 740454 Delivered-To: patch@linaro.org Received: by 2002:a5d:538f:0:b0:32d:baff:b0ca with SMTP id d15csp961968wrv; Thu, 2 Nov 2023 10:41:00 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHmw7YYuoCm+8GV1qWzK80Md7Is1PtYv+tqMUwntPcOh+Hnj7m6Bx8KGEWd8QcUWqDPe4OW X-Received: by 2002:a1f:2ac9:0:b0:49a:1605:ee6a with SMTP id q192-20020a1f2ac9000000b0049a1605ee6amr17999192vkq.5.1698946860299; Thu, 02 Nov 2023 10:41:00 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1698946860; cv=none; d=google.com; s=arc-20160816; b=CAeA6iyD+qEMfL3+511vdSUGWOVvhPVOFkT2l3vnEeBpnSUIvuNKeQ+F/2rip2n+To xXsqXU2HjD9xdMCdgWja2JKdPTKfdYm14FYEE7fY7uNrrZOlhABeDekK6bA09O9eDXEu Dnd5iLZxjFa+jrXrxi9opl84bMs0D+UqHbohNU30vXxaRHCOubjiTPbrNkg/xPtXrkHA NxLhAm86i3FYuyDB6EQ42p6t7OJgZxt9pS2fFQvOFcMfrHzLzMP5qVxbGI3ObmG6f0Nk 5D1PugR4F16l9kcN1zZbrdXYyEBAErrL9NRebpBWVj1lwvjxgE1sy0JSbWTjp716Yr/I wQig== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:to:from :dkim-signature; bh=KWyGEYTzfH2Abe6/qvv9Qz9Xy/UG4t+1CI7YQLR7W1Q=; fh=PnYt+qEB9tAfMKoqBm2xjKOFpYyFFGPudh5cVIoieJM=; b=Fr2qVPBznNF9ARaO6nI7/IyNl2AxgXYr+jV6tlqzBYCYT2IvGBKmkgnDS8Mtl+hKwT IQNuK/bencb7Y5sPwSbZWhW9bTHLD43IBFvl1rw/Suj+xOSYv5rCO3xXCg5NSTBNZblF 8avv2brh7Ddaa2w5uVuqjdEsd0PEvBdAO2M5k7SMqj2EpqTilfkDuRPJtdDcSMFl0dgP VKgn1oczviwt2Mg/VAhz0Od6FKMOSgzEUtt/FEaIiHHbX52OSj2NynION1pp9G4kGxNG a296IqRLVd6wlUeBXZNyCOBZCrahCAcog+/dHOFctwV7ynBdKtd2Ci9mWxgy5Tr36tOZ Q+WQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=jKRjq5+X; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id bj5-20020a05620a190500b0077892b417desi317809qkb.333.2023.11.02.10.41.00 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Thu, 02 Nov 2023 10:41:00 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=jKRjq5+X; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qybft-0004QL-Sh; Thu, 02 Nov 2023 13:40:10 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qybej-0003HN-Da for qemu-devel@nongnu.org; Thu, 02 Nov 2023 13:39:00 -0400 Received: from mail-wr1-x42d.google.com ([2a00:1450:4864:20::42d]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qybef-0002rx-B3 for qemu-devel@nongnu.org; Thu, 02 Nov 2023 13:38:56 -0400 Received: by mail-wr1-x42d.google.com with SMTP id ffacd0b85a97d-32d895584f1so662242f8f.1 for ; Thu, 02 Nov 2023 10:38:51 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1698946730; x=1699551530; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:from:to:cc:subject:date:message-id :reply-to; bh=KWyGEYTzfH2Abe6/qvv9Qz9Xy/UG4t+1CI7YQLR7W1Q=; b=jKRjq5+Xj+GZWXmghtiQDmDvxnYChqujeyC3rZHRI3p9JZ4SqAVP/VyKorWTogl6/U EXh0ffpRTWGtkuTpGoUoYfGHt6ibunT3YDTc2VhDHmqjm/S07tBPHJFLJz07QPBNxYNh XQaB42lFEX86Ct6qfqTC4o3yA+7HM4wui5Q/lNL9PCCkLwLcOBaGF+AAdTAZ8ZOf5ljO l97HJ/ADjXEld59v5pl7aURcBnwEKnft25UqO5s1/eVNDEVRU4exbJ0oUFDjpsSzB21B gcP9qZk9OjCq1jaJgPS862yY3TQ7+2kCCUoBL466wgSUuxhvc3mzrKF6c+ZN4llDLq54 A4Pg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1698946730; x=1699551530; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=KWyGEYTzfH2Abe6/qvv9Qz9Xy/UG4t+1CI7YQLR7W1Q=; b=HJWOwDAOX7VungykAilj1KPDqnB39HVTS0u5gFqHci49Hewd2L+Jnp59bL5KAsfdTE kasKfnsbtgQyZOQtg8ps2IhsGZnLXTroUeySSc249H5ds/2BprqsmP568CpEiKEEAlsY 5L5cojL8XRgoX/1/mV+lmr7vnNTFb7xgsQqoQfayqsHZ4ZJHZzRP87Y1+afpgCxZcwLo 9NSwZ8fSVGbeaZQquKJqw34hJOz4J3gNzzlXARZpc7EDreDxgLhj4BIM9nHLrDWUPCVL vcNJb7NYq40dWnYqaBPP7JWphdp1iqLS3pDGt7O/JxyLG9fT6dd/ZpHipigECUeO00qi 5LGA== X-Gm-Message-State: AOJu0YyLuhwkdyqtpvFuwzmJ2yBIgqjq2asy4umPDkYCsOetxEu9NN7R R4SMrxyws4Gg4Zvz1vr2/bfHD95KKQdFUZLRcpo= X-Received: by 2002:a5d:5987:0:b0:32f:8181:7d2b with SMTP id n7-20020a5d5987000000b0032f81817d2bmr12347763wri.32.1698946730472; Thu, 02 Nov 2023 10:38:50 -0700 (PDT) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [2001:8b0:1d0::2]) by smtp.gmail.com with ESMTPSA id e16-20020adff350000000b003258934a4bcsm3046805wrp.42.2023.11.02.10.38.50 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 02 Nov 2023 10:38:50 -0700 (PDT) From: Peter Maydell To: qemu-devel@nongnu.org Subject: [PULL 25/33] target/arm: Make FEAT_MOPS SET* insns handle Xs == XZR correctly Date: Thu, 2 Nov 2023 17:38:27 +0000 Message-Id: <20231102173835.609985-26-peter.maydell@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231102173835.609985-1-peter.maydell@linaro.org> References: <20231102173835.609985-1-peter.maydell@linaro.org> MIME-Version: 1.0 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, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org Most of the registers used by the FEAT_MOPS instructions cannot use 31 as a register field value; this is CONSTRAINED UNPREDICTABLE to NOP or UNDEF (we UNDEF). However, it is permitted for the "source value" register for the memset insns SET* to be 31, which (as usual for most data-processing insns) means it should be the zero register XZR. We forgot to handle this case, with the effect that trying to set memory to zero with a "SET* Xd, Xn, XZR" sets the memory to the value that happens to be in the low byte of SP. Handle XZR when getting the SET* data value from the register file. Signed-off-by: Peter Maydell Reviewed-by: Richard Henderson Reviewed-by: Philippe Mathieu-Daudé Message-id: 20231030174000.3792225-4-peter.maydell@linaro.org --- target/arm/tcg/helper-a64.c | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/target/arm/tcg/helper-a64.c b/target/arm/tcg/helper-a64.c index 84f54750fc2..ce4800b8d13 100644 --- a/target/arm/tcg/helper-a64.c +++ b/target/arm/tcg/helper-a64.c @@ -1206,6 +1206,15 @@ static void check_setg_alignment(CPUARMState *env, uint64_t ptr, uint64_t size, } } +static uint64_t arm_reg_or_xzr(CPUARMState *env, int reg) +{ + /* + * Runtime equivalent of cpu_reg() -- return the CPU register value, + * for contexts when index 31 means XZR (not SP). + */ + return reg == 31 ? 0 : env->xregs[reg]; +} + /* * For the Memory Set operation, our implementation chooses * always to use "option A", where we update Xd to the final @@ -1226,7 +1235,7 @@ static void do_setp(CPUARMState *env, uint32_t syndrome, uint32_t mtedesc, int rd = mops_destreg(syndrome); int rs = mops_srcreg(syndrome); int rn = mops_sizereg(syndrome); - uint8_t data = env->xregs[rs]; + uint8_t data = arm_reg_or_xzr(env, rs); uint32_t memidx = FIELD_EX32(mtedesc, MTEDESC, MIDX); uint64_t toaddr = env->xregs[rd]; uint64_t setsize = env->xregs[rn]; @@ -1286,7 +1295,7 @@ static void do_setm(CPUARMState *env, uint32_t syndrome, uint32_t mtedesc, int rd = mops_destreg(syndrome); int rs = mops_srcreg(syndrome); int rn = mops_sizereg(syndrome); - uint8_t data = env->xregs[rs]; + uint8_t data = arm_reg_or_xzr(env, rs); uint64_t toaddr = env->xregs[rd] + env->xregs[rn]; uint64_t setsize = -env->xregs[rn]; uint32_t memidx = FIELD_EX32(mtedesc, MTEDESC, MIDX); @@ -1349,7 +1358,7 @@ static void do_sete(CPUARMState *env, uint32_t syndrome, uint32_t mtedesc, int rd = mops_destreg(syndrome); int rs = mops_srcreg(syndrome); int rn = mops_sizereg(syndrome); - uint8_t data = env->xregs[rs]; + uint8_t data = arm_reg_or_xzr(env, rs); uint64_t toaddr = env->xregs[rd] + env->xregs[rn]; uint64_t setsize = -env->xregs[rn]; uint32_t memidx = FIELD_EX32(mtedesc, MTEDESC, MIDX); From patchwork Thu Nov 2 17:38:28 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 740461 Delivered-To: patch@linaro.org Received: by 2002:a5d:538f:0:b0:32d:baff:b0ca with SMTP id d15csp962147wrv; Thu, 2 Nov 2023 10:41:23 -0700 (PDT) X-Google-Smtp-Source: AGHT+IEkB8vwqzx2CSPH59apMFB9PvvIUoTbwP9MmReIrbIfCTDJTYnUSoqb7S+Ya3eJ0xj0NjWK X-Received: by 2002:a05:622a:1a16:b0:41e:280d:4e28 with SMTP id f22-20020a05622a1a1600b0041e280d4e28mr24145516qtb.40.1698946883605; Thu, 02 Nov 2023 10:41:23 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1698946883; cv=none; d=google.com; s=arc-20160816; b=Epg+ox8hKrmK2Q7aHX2IYjgxWgq/dSELq1ld6ZPJdENRJBvTUl2xz4ezUQZay8pDBC yTU6gJp/r+iuB8WhHLHJnKMCDCy9gEcLWUwG73zc+v22P2A+a2wD1+bM0uyN1XjcA21C RPqmFmFlJrVeIkXXcTmer25v62uJPUuKrCtmfctPgDYPj478oPE/CANXuBcKDVP0ew8e R2v9Tz9ozRUFXazOpqN7yNwl73V+V1K4rhThs539ihZAiV/q4Gqr+4FtOniEJhbMvLrk CerU/Kv6Qkm/V7E02tMOVWNh9rFy2Mk0c5mZlkeblHoMWybb9N5fEOA1ts9rN6TEe6rI mhwQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:to:from :dkim-signature; bh=Xl1Sssr8bZ1VD/O15KLMZF+fxbdudckI1BnKAqrNXHo=; fh=PnYt+qEB9tAfMKoqBm2xjKOFpYyFFGPudh5cVIoieJM=; b=rPARkw7KL248A375TgtKETeVvWrkprzvxs2dSNxKr2GqAiKxocGzLgpVw8Bv0o2SwE a+T652/CmJgbDoyruGOxEeKIy4LAwLLB4DNOgaxXmb7fjJlH/YuDFpB/TJwUUMuFzL1b WqhAb6UQXXyP2PPRXogMhcM6VM1AOkqd3wQSKJdAFb97e+Q05fK++zw0yD6v4JHDDzdT sOKVuXHU5wn26MeNP/4BYutv0UqVan0br1QBtQYnbNApo3eSXH+tWoxCtoZ/lSAXgx2r cz2Kpp3CybWu1QdGrYl2nvv9G2VMpC40df3MkLVUts82uyDqD0musCB0PVc5g5OEkrTx wqDw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=xDf7vfIJ; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id v6-20020a05622a144600b0041805eb9514si286503qtx.183.2023.11.02.10.41.23 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Thu, 02 Nov 2023 10:41:23 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=xDf7vfIJ; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qybfQ-0003sr-3n; Thu, 02 Nov 2023 13:39:40 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qybei-0003HA-Qn for qemu-devel@nongnu.org; Thu, 02 Nov 2023 13:39:00 -0400 Received: from mail-wr1-x42a.google.com ([2a00:1450:4864:20::42a]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qybef-0002sH-Aq for qemu-devel@nongnu.org; Thu, 02 Nov 2023 13:38:56 -0400 Received: by mail-wr1-x42a.google.com with SMTP id ffacd0b85a97d-32f7c80ab33so705278f8f.0 for ; Thu, 02 Nov 2023 10:38:51 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1698946731; x=1699551531; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:from:to:cc:subject:date:message-id :reply-to; bh=Xl1Sssr8bZ1VD/O15KLMZF+fxbdudckI1BnKAqrNXHo=; b=xDf7vfIJb7ZnpOKxmogljLKIVc8qzg+qUNXpkuZQaEpkr+yt0x7439G6vk1sjN03c/ OvZ73XeBj4Cpa5DOyh4pdvHfg+lCxOm2hlmQFp9DoPXIfIM+SsrChWoyYQN7jsZba/S9 ufAw+NU3vCydP+RTdrY585oaEmP4ugsOXCL8SLmTJzAbUJUHzTtrItk0aA4jUtfo+8a1 SIwLeh3CAWDTrzIKhP4593W24r6xTSZUbPKbvN3HdjXUDU9B2DDJ4d0kisSYKVZ/sm7g LSR3Ln71LNAIRoKaaZMk2WEVy1xHyms0AxNtAC5hbxPg30yKle+tm1REyQ03MCCnA2G8 7fWQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1698946731; x=1699551531; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=Xl1Sssr8bZ1VD/O15KLMZF+fxbdudckI1BnKAqrNXHo=; b=YYtQX9c/AqDFVWjV+RITwdhWmzpNZEOaWbOEREFWwnYPaVohDa6+HAmI8oW4UR0LHw 4yOqPp9RGmvMUqhKE7pOXAMCX8Ga8dMZ+jYH2sp4EVoh/5ikEk1nGqsE+cgrtMNK1bCX bTPbpQ2jiBGU3tiCfdt2D0CucoEYKb6KURsDufqI3nBtATuEug6+O4QKUmySneziAtz7 CBU7ZGLsuKBdTNvCCwOxcAFi58FWpy30ER9Nyp5QZOGNQUlZXk5rRE1N3WCiwuCnpVlk fPz+QJ/swbvJKASz1ZO7by4HOSDwiE+zY7y4DRVkLneRyWnOZ1yoBwxXhmIRurzm4T0F 8N7Q== X-Gm-Message-State: AOJu0YwAlh8x1C643r1jKaA0wvh5KRq9AsgqU7fC58ZY/9gOxwG7aDKf b4NAE4f0iyWuo0c6qmRsrDDjNzYTNpG9kwt4Ug4= X-Received: by 2002:adf:f605:0:b0:32d:89b5:7fd9 with SMTP id t5-20020adff605000000b0032d89b57fd9mr14318080wrp.56.1698946730889; Thu, 02 Nov 2023 10:38:50 -0700 (PDT) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [2001:8b0:1d0::2]) by smtp.gmail.com with ESMTPSA id e16-20020adff350000000b003258934a4bcsm3046805wrp.42.2023.11.02.10.38.50 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 02 Nov 2023 10:38:50 -0700 (PDT) From: Peter Maydell To: qemu-devel@nongnu.org Subject: [PULL 26/33] target/arm: Fix SVE STR increment Date: Thu, 2 Nov 2023 17:38:28 +0000 Message-Id: <20231102173835.609985-27-peter.maydell@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231102173835.609985-1-peter.maydell@linaro.org> References: <20231102173835.609985-1-peter.maydell@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::42a; envelope-from=peter.maydell@linaro.org; helo=mail-wr1-x42a.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, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org From: Richard Henderson The previous change missed updating one of the increments and one of the MemOps. Add a test case for all vector lengths. Cc: qemu-stable@nongnu.org Fixes: e6dd5e782be ("target/arm: Use tcg_gen_qemu_{ld, st}_i128 in gen_sve_{ld, st}r") Signed-off-by: Richard Henderson Reviewed-by: Philippe Mathieu-Daudé Message-id: 20231031143215.29764-1-richard.henderson@linaro.org [PMM: fixed checkpatch nit] Signed-off-by: Peter Maydell --- target/arm/tcg/translate-sve.c | 5 ++-- tests/tcg/aarch64/sve-str.c | 49 +++++++++++++++++++++++++++++++ tests/tcg/aarch64/Makefile.target | 6 +++- 3 files changed, 57 insertions(+), 3 deletions(-) create mode 100644 tests/tcg/aarch64/sve-str.c diff --git a/target/arm/tcg/translate-sve.c b/target/arm/tcg/translate-sve.c index 7b39962f209..296e7d1ce22 100644 --- a/target/arm/tcg/translate-sve.c +++ b/target/arm/tcg/translate-sve.c @@ -4294,7 +4294,7 @@ void gen_sve_str(DisasContext *s, TCGv_ptr base, int vofs, t0 = tcg_temp_new_i64(); t1 = tcg_temp_new_i64(); t16 = tcg_temp_new_i128(); - for (i = 0; i < len_align; i += 8) { + for (i = 0; i < len_align; i += 16) { tcg_gen_ld_i64(t0, base, vofs + i); tcg_gen_ld_i64(t1, base, vofs + i + 8); tcg_gen_concat_i64_i128(t16, t0, t1); @@ -4320,7 +4320,8 @@ void gen_sve_str(DisasContext *s, TCGv_ptr base, int vofs, t16 = tcg_temp_new_i128(); tcg_gen_concat_i64_i128(t16, t0, t1); - tcg_gen_qemu_st_i128(t16, clean_addr, midx, MO_LEUQ); + tcg_gen_qemu_st_i128(t16, clean_addr, midx, + MO_LE | MO_128 | MO_ATOM_NONE); tcg_gen_addi_i64(clean_addr, clean_addr, 16); tcg_gen_brcondi_ptr(TCG_COND_LTU, i, len_align, loop); diff --git a/tests/tcg/aarch64/sve-str.c b/tests/tcg/aarch64/sve-str.c new file mode 100644 index 00000000000..ae271c9d87e --- /dev/null +++ b/tests/tcg/aarch64/sve-str.c @@ -0,0 +1,49 @@ +#include +#include + +#define N (256 + 16) + +static int __attribute__((noinline)) test(int vl) +{ + unsigned char buf[N]; + int err = 0; + + for (int i = 0; i < N; ++i) { + buf[i] = (unsigned char)i; + } + + asm volatile ( + "mov z0.b, #255\n\t" + "str z0, %0" + : : "m" (buf) : "z0", "memory"); + + for (int i = 0; i < vl; ++i) { + if (buf[i] != 0xff) { + fprintf(stderr, "vl %d, index %d, expected 255, got %d\n", + vl, i, buf[i]); + err = 1; + } + } + + for (int i = vl; i < N; ++i) { + if (buf[i] != (unsigned char)i) { + fprintf(stderr, "vl %d, index %d, expected %d, got %d\n", + vl, i, (unsigned char)i, buf[i]); + err = 1; + } + } + + return err; +} + +int main() +{ + int err = 0; + + for (int i = 16; i <= 256; i += 16) { + if (prctl(PR_SVE_SET_VL, i, 0, 0, 0, 0) == i) { + err |= test(i); + } + } + return err; +} diff --git a/tests/tcg/aarch64/Makefile.target b/tests/tcg/aarch64/Makefile.target index 0c84b61ae0e..cded1d01fcd 100644 --- a/tests/tcg/aarch64/Makefile.target +++ b/tests/tcg/aarch64/Makefile.target @@ -103,7 +103,11 @@ sha512-sve: CFLAGS=-O3 -march=armv8.1-a+sve sha512-sve: sha512.c $(CC) $(CFLAGS) $(EXTRA_CFLAGS) $< -o $@ $(LDFLAGS) -TESTS += sha512-sve +sve-str: CFLAGS=-O1 -march=armv8.1-a+sve +sve-str: sve-str.c + $(CC) $(CFLAGS) $(EXTRA_CFLAGS) $< -o $@ $(LDFLAGS) + +TESTS += sha512-sve sve-str ifneq ($(GDB),) GDB_SCRIPT=$(SRC_PATH)/tests/guest-debug/run-test.py From patchwork Thu Nov 2 17:38:29 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 740465 Delivered-To: patch@linaro.org Received: by 2002:a5d:538f:0:b0:32d:baff:b0ca with SMTP id d15csp962515wrv; Thu, 2 Nov 2023 10:42:18 -0700 (PDT) X-Google-Smtp-Source: AGHT+IF0Wg5DcSW10vVwQ4oW1n3glX7XMndS7E2Dd7f6/PFH9ItgFp4UpuoGFOnOIOlrCiwSAwNT X-Received: by 2002:a05:600c:21cf:b0:401:b92f:eec5 with SMTP id x15-20020a05600c21cf00b00401b92feec5mr279588wmj.9.1698946938597; Thu, 02 Nov 2023 10:42:18 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1698946938; cv=none; d=google.com; s=arc-20160816; b=p8SnXRaZDaHzxKO+zd3det+i17fQG9eKygEcqfxJsuvhO9uakFDOEL6JC8LW1/T4zB Wt9kKjgtdSHKskkZjg8x13fANeBO/EAjdmQ2j7Hi1OmTLviaB3e+7ylwxnYIQ2s8rgo1 S8Z2UsfBIiJHgYwGHTsshVbX7s68RTJOXiPbVINBzZLmjWFIoEpb4k7128gjSpU+c9jG uwnMxsyLIALVu74RJwzbBpIrMBO1o1HNRwP6WRmNCnAmPaF5O+KrQn+GZJ3uLvMgKmG6 9cWWqWUEAKvVhwvc24Cnt7NV0o7nvfavBGP46/GjNni6S3yhkIBFA/v2eNWwiDdOZ8FU vN/w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:to:from :dkim-signature; bh=CwqI4acJjz6s4N0ziHLsowruaotlOGTTthUe1CdZYBE=; fh=PnYt+qEB9tAfMKoqBm2xjKOFpYyFFGPudh5cVIoieJM=; b=co9EXou/fH0IosFBgLPxS0ZEI43ByHTIKt63VRX2ykHQEfgsaf1iA+pgbLRAlll8MZ KZWGrVqq53g9Hvor6db7imtooEZAq9vQYU/mmitnCDmy2RMWAu+sZjkxkO1SIzF6Kggv SofJ9DcH/zMQee2KcO5aNULM4UYeNxIhKsFWA5Xz7A1JGTUhsT1NjAHpFvQZf+96HWsn a5KnsHwAl7TTjo+QP8mlL3IakkISwOFplQQvdgUHwqUvteJQQakIxqgzAcTydkNSXRAz WWqH8u8j2bTQMlm+2qkIfkhz2XxCZS15rfrTcV9bzLtovwNyzQZCjyVRbjur7V5HioH0 791A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=OHylroom; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id q14-20020a7bce8e000000b004084e474052si98280wmj.180.2023.11.02.10.42.18 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Thu, 02 Nov 2023 10:42:18 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=OHylroom; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qybgg-0005v6-Qt; Thu, 02 Nov 2023 13:40:58 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qybej-0003HO-Dn for qemu-devel@nongnu.org; Thu, 02 Nov 2023 13:39:00 -0400 Received: from mail-wr1-x436.google.com ([2a00:1450:4864:20::436]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qybef-0002su-BB for qemu-devel@nongnu.org; Thu, 02 Nov 2023 13:38:56 -0400 Received: by mail-wr1-x436.google.com with SMTP id ffacd0b85a97d-32fb190bf9bso420234f8f.1 for ; Thu, 02 Nov 2023 10:38:52 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1698946731; x=1699551531; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:from:to:cc:subject:date:message-id :reply-to; bh=CwqI4acJjz6s4N0ziHLsowruaotlOGTTthUe1CdZYBE=; b=OHylroomT0by7hpr9M9CG1+t6uHuM5S/AbfKa76dZq+UFgfND2fYxzwoyNxbd5bFh5 iUvgoeQV3mTN0F2g8DW5bOqqg2Nwge+kILkKPdVn2HweLSRPO9ZC0LJTh8OF3zLv8ade 8eqM8SLcpJQa1xWSj2BEgt+PODD26ifVWuFtD5lJQu2hiZRh+YDOsAQ7V4bSNdsgFgXj bf/TMrDyrZmFBKGEn/xEQ+azrDdibKnBd4C+RvUKfKpLrTckoE0PGfxPkFcXWBjed9AA FW8fgHEvrNtQ4/7ZttlRWavmlkgbMjJCQZKFjs7nPd0LxoPny9OehiOW0yKQn/0UYfU9 h8GQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1698946731; x=1699551531; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=CwqI4acJjz6s4N0ziHLsowruaotlOGTTthUe1CdZYBE=; b=iq3xooKZfG1qF/KuBw9+Sk2qJVDdHnltsWXLLqEtIHtiNUyfxShpJsn1urgoc7oG2l EllSzs3T55/6UVzr0sNBdOzheN4BxGtEL6deupfkdAN7kG5btb9noNJStrMElOmKDqhT DByKqyq4TWSF72EH1ytkFGmOEGss8Hsoy+dqKAKxFcpAY4pnrv0xAogAsoACJL2Jf6Xi BFSdw9TZ8MP3ip9OsopK7YX4zgYrm56+i2KMmj7YwsdWHOvzkRH4EOJ+yW21JZBRAfel gHe+/rbwxd5jUmu8Xqg5blkyjULxXzSdLX1doFvzA8QRQFUiON/PywtrjemmP4AVm78T i3oQ== X-Gm-Message-State: AOJu0YyBrT9tskeDl/Hn+gHwDrZG3Us8kYjBpolihCTwGQu+Zo+3v7eo 4gaubTFxC+0/pei7nhct7tdisEpTgCkwOW6GnmM= X-Received: by 2002:a5d:64e3:0:b0:32f:8b77:d423 with SMTP id g3-20020a5d64e3000000b0032f8b77d423mr679039wri.3.1698946731371; Thu, 02 Nov 2023 10:38:51 -0700 (PDT) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [2001:8b0:1d0::2]) by smtp.gmail.com with ESMTPSA id e16-20020adff350000000b003258934a4bcsm3046805wrp.42.2023.11.02.10.38.51 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 02 Nov 2023 10:38:51 -0700 (PDT) From: Peter Maydell To: qemu-devel@nongnu.org Subject: [PULL 27/33] hw/char/stm32f2xx_usart: Extract common IRQ update code to update_irq() Date: Thu, 2 Nov 2023 17:38:29 +0000 Message-Id: <20231102173835.609985-28-peter.maydell@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231102173835.609985-1-peter.maydell@linaro.org> References: <20231102173835.609985-1-peter.maydell@linaro.org> MIME-Version: 1.0 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, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org From: Hans-Erik Floryd Signed-off-by: Philippe Mathieu-Daudé Reviewed-by: Richard Henderson Reviewed-by: Alistair Francis Signed-off-by: Hans-Erik Floryd Message-id: 20231030151528.1138131-2-hans-erik.floryd@rt-labs.com Signed-off-by: Peter Maydell --- hw/char/stm32f2xx_usart.c | 28 ++++++++++++++++------------ 1 file changed, 16 insertions(+), 12 deletions(-) diff --git a/hw/char/stm32f2xx_usart.c b/hw/char/stm32f2xx_usart.c index fde67f4f03f..519d3461a33 100644 --- a/hw/char/stm32f2xx_usart.c +++ b/hw/char/stm32f2xx_usart.c @@ -53,6 +53,17 @@ static int stm32f2xx_usart_can_receive(void *opaque) return 0; } +static void stm32f2xx_update_irq(STM32F2XXUsartState *s) +{ + uint32_t mask = s->usart_sr & s->usart_cr1; + + if (mask & (USART_SR_TXE | USART_SR_TC | USART_SR_RXNE)) { + qemu_set_irq(s->irq, 1); + } else { + qemu_set_irq(s->irq, 0); + } +} + static void stm32f2xx_usart_receive(void *opaque, const uint8_t *buf, int size) { STM32F2XXUsartState *s = opaque; @@ -66,9 +77,7 @@ static void stm32f2xx_usart_receive(void *opaque, const uint8_t *buf, int size) s->usart_dr = *buf; s->usart_sr |= USART_SR_RXNE; - if (s->usart_cr1 & USART_CR1_RXNEIE) { - qemu_set_irq(s->irq, 1); - } + stm32f2xx_update_irq(s); DB_PRINT("Receiving: %c\n", s->usart_dr); } @@ -85,7 +94,7 @@ static void stm32f2xx_usart_reset(DeviceState *dev) s->usart_cr3 = 0x00000000; s->usart_gtpr = 0x00000000; - qemu_set_irq(s->irq, 0); + stm32f2xx_update_irq(s); } static uint64_t stm32f2xx_usart_read(void *opaque, hwaddr addr, @@ -106,7 +115,7 @@ static uint64_t stm32f2xx_usart_read(void *opaque, hwaddr addr, retvalue = s->usart_dr & 0x3FF; s->usart_sr &= ~USART_SR_RXNE; qemu_chr_fe_accept_input(&s->chr); - qemu_set_irq(s->irq, 0); + stm32f2xx_update_irq(s); return retvalue; case USART_BRR: return s->usart_brr; @@ -145,9 +154,7 @@ static void stm32f2xx_usart_write(void *opaque, hwaddr addr, } else { s->usart_sr &= value; } - if (!(s->usart_sr & USART_SR_RXNE)) { - qemu_set_irq(s->irq, 0); - } + stm32f2xx_update_irq(s); return; case USART_DR: if (value < 0xF000) { @@ -168,10 +175,7 @@ static void stm32f2xx_usart_write(void *opaque, hwaddr addr, return; case USART_CR1: s->usart_cr1 = value; - if (s->usart_cr1 & USART_CR1_RXNEIE && - s->usart_sr & USART_SR_RXNE) { - qemu_set_irq(s->irq, 1); - } + stm32f2xx_update_irq(s); return; case USART_CR2: s->usart_cr2 = value; From patchwork Thu Nov 2 17:38:30 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 740456 Delivered-To: patch@linaro.org Received: by 2002:a5d:538f:0:b0:32d:baff:b0ca with SMTP id d15csp962046wrv; Thu, 2 Nov 2023 10:41:10 -0700 (PDT) X-Google-Smtp-Source: AGHT+IH9pKHLz3ncB3dODlBJnXH4yclheouhgWFdgXGb8yWY7F8HuSfkwHq5bU3LbrQAzNKegEi0 X-Received: by 2002:a05:620a:1a83:b0:777:2e76:feb1 with SMTP id bl3-20020a05620a1a8300b007772e76feb1mr23101146qkb.10.1698946870096; Thu, 02 Nov 2023 10:41:10 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1698946870; cv=none; d=google.com; s=arc-20160816; b=I24o2mWCUm76uQIWY++T26uQIQCPjR0ejmc10c14snzFZJ+EF1a0khV/2yFU3znmsr CrCA754hXkq2lFSA9tzUp2ANGdM2nUBXSbySxZyWbTnwC7pvFAwsolCfgw+y7tRQNiKz V4gqPrlMcvOTtavouerm8KZI6HaRck7qVNOYPJRmvS6SeK1LeBGiAIq4QaI2xr+IEKBP usLMYU/k6aIN+Zo8y+wvnoyz+xfOfQFy4zV+1lpCFFoyrELEBoIHIlYl7qgrw5dgFhRz fJEhsMXJAicUlKhwA2gObd9IkAhMhT5NXEU3rNH+jmElvjFN0cJ+TUDIEun+W9b5IKaJ U3PQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:to:from :dkim-signature; bh=jF0lqfreU7N6ImEIjsmoU/+iBQdAY2xp+peBqMSgOts=; fh=PnYt+qEB9tAfMKoqBm2xjKOFpYyFFGPudh5cVIoieJM=; b=0Y1g+gXXoq4gCsJ+3dUigUkimsRuHOSm1Q8QWZWRyLypC2CTgj3OUGkRLuRrpx7NIf wp+rfcBmj8UIvbSN2upukDwcQf0cDWL30eMJX1gyzMDEKAQXTilE4UadY+ergaCJufGT ++qCOlUPqQ/15zp6I3sj1PoQF/XfjhE3iDVY+feoD4ZT36otxDGytY7QxqEIMAaNPuRJ a3yCBGGE87rMJLM19pG1u7QCEsjhgZ/u2O0Pt8jJ0vflCy71+e1azlrbMkToupKVSXk9 UDeLeTuLYA6TcLS41gA55M1g6LoirriAEKbO7BSfAX7rRYZRi4IuPb4fWW8C3fKfqWqU erGw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=W9XGCU52; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id t14-20020a05620a450e00b007758e5dba52si317006qkp.307.2023.11.02.10.41.09 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Thu, 02 Nov 2023 10:41:10 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=W9XGCU52; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qybfD-0003Pk-FU; Thu, 02 Nov 2023 13:39:29 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qybej-0003HM-Db for qemu-devel@nongnu.org; Thu, 02 Nov 2023 13:39:00 -0400 Received: from mail-wr1-x430.google.com ([2a00:1450:4864:20::430]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qybef-0002ug-Ul for qemu-devel@nongnu.org; Thu, 02 Nov 2023 13:38:56 -0400 Received: by mail-wr1-x430.google.com with SMTP id ffacd0b85a97d-32f9268bf8cso668694f8f.0 for ; Thu, 02 Nov 2023 10:38:53 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1698946732; x=1699551532; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:from:to:cc:subject:date:message-id :reply-to; bh=jF0lqfreU7N6ImEIjsmoU/+iBQdAY2xp+peBqMSgOts=; b=W9XGCU52g/QoDpMP2KolJxevk+TYo8ncUUnU13gINWs3kXuZAEwFYJ+nB4KtL6QLMC iqwd/ZVi6teCV4amN5r+HNmf6GWnlgeXM0ktRkSZPHQU0+0jn6VBNJ3X75KLVN+PqpCV 5Y/AAv8Sm7tU0zZpDwurp/AyLeij0nnE9WSQ6AxSaidHOTGUspaY1a966Ga5JKFTVpQO FVD4td5zCtNx4FWrUkW/6zjyQhOj6ecrlKWQUrJIFTc0u8m6n2+01AubU72raUO7B+cD SivR97ZQOsjQk5q5CL+nvGA2dhXjS0ML6ctS9u37uqi2nvcl98MuIUTjP571l0cM+qO2 tcXQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1698946732; x=1699551532; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=jF0lqfreU7N6ImEIjsmoU/+iBQdAY2xp+peBqMSgOts=; b=eDPh6/sIGifb3umoCxnVbAwFVYmEve4Lq6NIcFqGgTDBojvk8XsoWYrcmISCOXQXYt /KXzcQ/dHVdlQDFYq2sOZZIuvwmhHa4fGzPrjZ2M6oWz28fHfjfeYSzhcszC2YhuSS84 DeQdkUfrq8JWWmHwT9+59E8K2aDBe16TtFImAZOPFiFzdDneo3HfyrrDdxnon/oVESzR H7nP7QVa6T2gQqwVS7SMQZvGUDZYqUMYnLzPRBpQIa3htuzvFCxafdrSW26Q3wChlCOg 8BdrNPus8BvWmKHSdNid354ftmmebfdwz3uwwJaymB3IP5DIr3Gia+LDjg9UaBLVI+57 U0KQ== X-Gm-Message-State: AOJu0YzuhEQLUiKP4FrZfYIIzxdxaAuCm3FHVgmGB/5FVK2w6MkO6dii 1+Nzom6gsH5wNr0Cpk5IWMNpb1IqcwTo8WY29vg= X-Received: by 2002:a05:6000:194c:b0:32d:a3a0:e927 with SMTP id e12-20020a056000194c00b0032da3a0e927mr12358068wry.58.1698946731882; Thu, 02 Nov 2023 10:38:51 -0700 (PDT) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [2001:8b0:1d0::2]) by smtp.gmail.com with ESMTPSA id e16-20020adff350000000b003258934a4bcsm3046805wrp.42.2023.11.02.10.38.51 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 02 Nov 2023 10:38:51 -0700 (PDT) From: Peter Maydell To: qemu-devel@nongnu.org Subject: [PULL 28/33] hw/char/stm32f2xx_usart: Update IRQ when DR is written Date: Thu, 2 Nov 2023 17:38:30 +0000 Message-Id: <20231102173835.609985-29-peter.maydell@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231102173835.609985-1-peter.maydell@linaro.org> References: <20231102173835.609985-1-peter.maydell@linaro.org> MIME-Version: 1.0 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, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org From: Hans-Erik Floryd Signed-off-by: Philippe Mathieu-Daudé Reviewed-by: Richard Henderson Reviewed-by: Alistair Francis Signed-off-by: Hans-Erik Floryd Message-id: 20231030151528.1138131-3-hans-erik.floryd@rt-labs.com Signed-off-by: Peter Maydell --- hw/char/stm32f2xx_usart.c | 1 + 1 file changed, 1 insertion(+) diff --git a/hw/char/stm32f2xx_usart.c b/hw/char/stm32f2xx_usart.c index 519d3461a33..8753afeb2b8 100644 --- a/hw/char/stm32f2xx_usart.c +++ b/hw/char/stm32f2xx_usart.c @@ -168,6 +168,7 @@ static void stm32f2xx_usart_write(void *opaque, hwaddr addr, clear TC by writing 0 to the SR register, so set it again on each write. */ s->usart_sr |= USART_SR_TC; + stm32f2xx_update_irq(s); } return; case USART_BRR: From patchwork Thu Nov 2 17:38:31 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 740466 Delivered-To: patch@linaro.org Received: by 2002:a5d:538f:0:b0:32d:baff:b0ca with SMTP id d15csp962544wrv; Thu, 2 Nov 2023 10:42:22 -0700 (PDT) X-Google-Smtp-Source: AGHT+IG2Rt/9+vfCA5fBSJhwNGMubcd/QRd8ZhpcA9ZCE+AvvfIHm9XVR7TxK+FKkAUvNiAxKqwD X-Received: by 2002:a05:6512:709:b0:503:3281:2ffd with SMTP id b9-20020a056512070900b0050332812ffdmr13305553lfs.41.1698946942348; Thu, 02 Nov 2023 10:42:22 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1698946942; cv=none; d=google.com; s=arc-20160816; b=x9WET2JJwb4wCnR7hvVGrSGFYDcDnX42txDR+/90PyMPd6jxChkIYWxkxRoeU6XHoI Tl1pyqDtrLxzH7lLI9mdVonasX8UMHAafC3P7REmRVQdll6+9AtMi5e8Z/mgPxhr7W+N cIIn9MloySm+wiUu1tv4gFq/Gqh1k0ube6Qjg1lW3TIlB0cE+B3oE8XpCnSjG78XN6ER ExStqgPI1qIxvVO2tTS2JIqMrDBG6nkrXgmH66vHsPwF1JWVLcayiIlygH6eNsdSpux1 c3oWTgPO+2gLqo3XImPUVURAKd07Z9zTmBcTHgbRrzyW6+R3kZgITg0sAr6MlkL9FuR+ nvtQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:to:from :dkim-signature; bh=sPFWc1s7OJlbSKqVGRhWCnDV7XV3swiqvpQRbW+f2QQ=; fh=PnYt+qEB9tAfMKoqBm2xjKOFpYyFFGPudh5cVIoieJM=; b=ljs+Qj5O6ExAh08CPg9zfybVybSAsd89faXy8b13y5kRcN5SGKKuAkJz7w9WfvRmON 9d0AcFPfbtZHeVaS6ryOxwI9D0lda0DOSnpfm/eINt8GaxOXtQieUkcYhMJnGTukvTc9 VmkRKB64IrbWSPvNg2CH4u8n/sumHt5h1yVh4HAIAEnE6iPGtheE5QMw7JMninSCb6Gi OxX3TeicZKqam0AQ5ztjYrp4Et9ibr2p/IuNffUDUHNOb8iIjBM7A0VR13EC9qDuwoKP 94in8ZJOw2Pnj5EhJwZxG/U7TVydafsjl3KmUYw5iWvlRttfsAmbyuEsYNC74x4YCEbk yPdg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="Tsu/4h8J"; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id a6-20020adfed06000000b0032d9c985505si1846655wro.949.2023.11.02.10.42.22 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Thu, 02 Nov 2023 10:42:22 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="Tsu/4h8J"; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qybfR-0003tT-AI; Thu, 02 Nov 2023 13:39:41 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qybej-0003HP-Dz for qemu-devel@nongnu.org; Thu, 02 Nov 2023 13:39:00 -0400 Received: from mail-wr1-x42a.google.com ([2a00:1450:4864:20::42a]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qybeg-0002ys-Rl for qemu-devel@nongnu.org; Thu, 02 Nov 2023 13:38:56 -0400 Received: by mail-wr1-x42a.google.com with SMTP id ffacd0b85a97d-32f8441dfb5so745309f8f.0 for ; Thu, 02 Nov 2023 10:38:54 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1698946733; x=1699551533; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:from:to:cc:subject:date:message-id :reply-to; bh=sPFWc1s7OJlbSKqVGRhWCnDV7XV3swiqvpQRbW+f2QQ=; b=Tsu/4h8JLzq7JobhgKmiSIYx25jhrH4Oh+tCwfQ9ikKfZ5Q+TScVl6WamPcdmoIFVm 00bmmKVluXSzVxVXwUt1wwW8iaKRduaSuesd9TKjMobFj4btYZPoF1Beq2K4iLiNJSJD HYSLv8kgdlnZMY4upEcrvenVulytjgi97PO6/heER8Inhm8NjCA3kGe/ijQaJ6ohxk5T CBpgO/Ndj8xwjB1wDDljl2Jb8fLJVEz9SsnFJkuYzZ+EfZyFFG1rTZat38v2x7qP99Ft dVaNg5kB1jdDm65CvcI7rqEKKZ7v9GqnzyOqgvXY3HK1gNZ7E7SP6uzt4cAFBgkL9rlE DSlA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1698946733; x=1699551533; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=sPFWc1s7OJlbSKqVGRhWCnDV7XV3swiqvpQRbW+f2QQ=; b=v9s90g1y7cDKHz5u4tfD9cF8KwDWlKtyPD4sXBCT9tV+kxYfFhByVgTMKZi7Gshj4x YINmwTNcT9cU76dSy+hM+RM0J+1VTf33OKOAr1vsuCO53hsQwE4ROjkJBhCYVsA5CpJU 72PJh23PA5utMVOvZMjFBliCQUJgl93T8oGpaHqSqwnzcmzE1w5epjxCpYdTUcgh9QS8 KHMN1kA9dC9kK0VcHONIbCBoKAOXxeeZHUMK8TRlP0r9AO9OQDpnoLXFNa2Dv7xX8VvH 7tC+H2yvpFVR11M1pxHL90gsJbRCBFBIkxtJmaJfld2sP5SR3KCdxsp35W/34ZRVSeyY MUIg== X-Gm-Message-State: AOJu0YyI/sPRECvNkbvdiGgXGIaKCkJacEoFLRXP3elPEvgqz7qopBmC 9fKIuxC1IuIW6lEbd4cHu96YUnL3CjImvZxY020= X-Received: by 2002:a05:6000:2ce:b0:32f:7e24:ddaf with SMTP id o14-20020a05600002ce00b0032f7e24ddafmr16011841wry.10.1698946733031; Thu, 02 Nov 2023 10:38:53 -0700 (PDT) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [2001:8b0:1d0::2]) by smtp.gmail.com with ESMTPSA id e16-20020adff350000000b003258934a4bcsm3046805wrp.42.2023.11.02.10.38.52 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 02 Nov 2023 10:38:52 -0700 (PDT) From: Peter Maydell To: qemu-devel@nongnu.org Subject: [PULL 29/33] hw/char/stm32f2xx_usart: Add more definitions for CR1 register Date: Thu, 2 Nov 2023 17:38:31 +0000 Message-Id: <20231102173835.609985-30-peter.maydell@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231102173835.609985-1-peter.maydell@linaro.org> References: <20231102173835.609985-1-peter.maydell@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::42a; envelope-from=peter.maydell@linaro.org; helo=mail-wr1-x42a.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, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org From: Hans-Erik Floryd Signed-off-by: Philippe Mathieu-Daudé Reviewed-by: Richard Henderson Acked-by: Alistair Francis Signed-off-by: Hans-Erik Floryd Message-id: 20231030151528.1138131-4-hans-erik.floryd@rt-labs.com Signed-off-by: Peter Maydell --- include/hw/char/stm32f2xx_usart.h | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/include/hw/char/stm32f2xx_usart.h b/include/hw/char/stm32f2xx_usart.h index 65bcc85470d..fdfa7424a70 100644 --- a/include/hw/char/stm32f2xx_usart.h +++ b/include/hw/char/stm32f2xx_usart.h @@ -48,10 +48,12 @@ #define USART_SR_TC (1 << 6) #define USART_SR_RXNE (1 << 5) -#define USART_CR1_UE (1 << 13) -#define USART_CR1_RXNEIE (1 << 5) -#define USART_CR1_TE (1 << 3) -#define USART_CR1_RE (1 << 2) +#define USART_CR1_UE (1 << 13) +#define USART_CR1_TXEIE (1 << 7) +#define USART_CR1_TCEIE (1 << 6) +#define USART_CR1_RXNEIE (1 << 5) +#define USART_CR1_TE (1 << 3) +#define USART_CR1_RE (1 << 2) #define TYPE_STM32F2XX_USART "stm32f2xx-usart" OBJECT_DECLARE_SIMPLE_TYPE(STM32F2XXUsartState, STM32F2XX_USART) From patchwork Thu Nov 2 17:38:32 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 740470 Delivered-To: patch@linaro.org Received: by 2002:a5d:538f:0:b0:32d:baff:b0ca with SMTP id d15csp962634wrv; Thu, 2 Nov 2023 10:42:35 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGD9RXcTKDCXEftgGlLjyAfhEzaKBWRHNJrr9NE9tYvRfL5Df/N4oFq9UCXKEkKP2MzrVG3 X-Received: by 2002:adf:f506:0:b0:323:16c0:9531 with SMTP id q6-20020adff506000000b0032316c09531mr14156777wro.13.1698946954964; Thu, 02 Nov 2023 10:42:34 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1698946954; cv=none; d=google.com; s=arc-20160816; b=eEYCeBo6eQHFeE2Upcb8yEdEIDr6wfNKcAmsZfyhJ7Xebrlo3YZGiXBuNJNoRTSUAW OC8tLBFPR3F02D8gNS431lOWQYSx8IFdTsDbCwXH6tv/kbTNEdcwyJNwVb0TmnnXtttC JovNNuOChOUyYghAUXhrArN3n1wQ4gpD1QFXyP3Xpyk4ZzQeQSwusQAitN8LE7rkhgVX /FSe0x3hfnAno26VMOz6q2KMuHOV2oolq5cixxb+umw1yRhD7iaNb7gNpDmu77d7kBH0 SnT4982ruIX+PvrKPRSjeCc64ov+G74qYzLYQJ/wFE/MHxPZO49RRa4mINOyI9oYG+gY /+FQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:to:from :dkim-signature; bh=Q7gNhyKm+XeQ9PyUruTJ7pm1OOgSYvOzpb6f9nuBc4M=; fh=PnYt+qEB9tAfMKoqBm2xjKOFpYyFFGPudh5cVIoieJM=; b=x+iV6EwA7217kWAZ2NKur0bxO6wuNjoxgBAMSrnvP3ws2ZCMViI6/GAqkI3X4tzDFG qHsXMPwFlYQabaePzrnaPIxkxxNti8Zip011onh+i1yd9ZGznl/7d93K1v70UjTPEaQO W15QsB0uKXSMS97Ns7MjQsWuNiW9PvI8P3ZlElZXyLuf0Fx8tZYEdLkTw0xFuYHoY/0Z BQ1wmEcXLLaKsIYOmK2Zy7pTUldMHWRXjUd9JOmPx9Hhq1uRrsZkKPfIgqKW0tXKwMfE /6dszsLntGDDMYcSe5q/77tr/xO0zkxrnhSw6pH8oZqpUK7xI8CLQsoCIjikhLh1MDzr W3cg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=yAbiL+LB; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id d6-20020a056000186600b0032f7c24b593si2012864wri.235.2023.11.02.10.42.34 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Thu, 02 Nov 2023 10:42:34 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=yAbiL+LB; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qybfH-0003Vi-CY; Thu, 02 Nov 2023 13:39:31 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qybek-0003Hi-7h for qemu-devel@nongnu.org; Thu, 02 Nov 2023 13:39:00 -0400 Received: from mail-wm1-x329.google.com ([2a00:1450:4864:20::329]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qybeh-0002zF-5H for qemu-devel@nongnu.org; Thu, 02 Nov 2023 13:38:57 -0400 Received: by mail-wm1-x329.google.com with SMTP id 5b1f17b1804b1-40906fc54fdso9422745e9.0 for ; Thu, 02 Nov 2023 10:38:54 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1698946733; x=1699551533; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:from:to:cc:subject:date:message-id :reply-to; bh=Q7gNhyKm+XeQ9PyUruTJ7pm1OOgSYvOzpb6f9nuBc4M=; b=yAbiL+LBGQmM+teNocOqgKn6/Xu4h7l66wgctuplQV5H0R+1Og+dFwd9a48R49q2m0 bD0vLc0+o65yWXEkt5ifjxbCyzTHUBN1LV3BvGCNlC04KKgP+OsNYLfOr1odLHnJTwxK c9mf11eFnbjDz8tPk2KRL49hop3iSdbHx/uXUMbrSc+8WKObk//XiACdv5nqHw7XhmDg 7FVAu10GAvyVbxIMYoNzAytHHouEOWqN3Sgwe0f0KR1WTxDoHGEHZ5o/7F1X7q9PEFTS 99yqDGFuFk1CfVH3zWW+xmrVtk1BJ6iuWmbPIXN7PYCfKUo5UvrNnw1Xvj3Zb4Q26H5d qL/w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1698946733; x=1699551533; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=Q7gNhyKm+XeQ9PyUruTJ7pm1OOgSYvOzpb6f9nuBc4M=; b=cnZ97TIKuB4/9THN84mEFy/74ic6RfEGwCYfE0zohr7+4QC9Di951pnncSBZUOWPJ8 mBVuZ16rWmQVBSkMRC7kucUJJaOFeaLz/F6uEQL5zxdWqfTXq8xIzc1nArY7YaDAvQHp TYoBoToacVf7BU/FEal35M6f/b2ZmmEtfpjBsz0iDKmphWhXHwqZ/oEYtibu+qsnUcy5 G1Cnucw8MzA0fYgv2ATwd78ckCB7WK9CElppUpeyiDLtc14B+iWLKHq/rPsGbb+kTGt5 D0EQSyhVGyRJY4k+WpAy6W0qbQxC23nGyD8eIXiAVcgzxu7WcOExLPRVhHB7HvYWPwqT 1KCA== X-Gm-Message-State: AOJu0YxM5sNfkwM9UQcapjh8KCXm6eyXSP9M5AW4lfaZWZsrWsAZPj3n 2YuknA3OpUOtmALL0GBpJURX0LlEaQanYDoMsI4= X-Received: by 2002:a5d:6c68:0:b0:32f:7f09:160f with SMTP id r8-20020a5d6c68000000b0032f7f09160fmr14221324wrz.12.1698946733563; Thu, 02 Nov 2023 10:38:53 -0700 (PDT) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [2001:8b0:1d0::2]) by smtp.gmail.com with ESMTPSA id e16-20020adff350000000b003258934a4bcsm3046805wrp.42.2023.11.02.10.38.53 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 02 Nov 2023 10:38:53 -0700 (PDT) From: Peter Maydell To: qemu-devel@nongnu.org Subject: [PULL 30/33] target/arm: Correctly propagate stage 1 BTI guarded bit in a two-stage walk Date: Thu, 2 Nov 2023 17:38:32 +0000 Message-Id: <20231102173835.609985-31-peter.maydell@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231102173835.609985-1-peter.maydell@linaro.org> References: <20231102173835.609985-1-peter.maydell@linaro.org> MIME-Version: 1.0 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, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org In a two-stage translation, the result of the BTI guarded bit should be the guarded bit from the first stage of translation, as there is no BTI guard information in stage two. Our code tried to do this, but got it wrong, because we currently have two fields where the GP bit information might live (ARMCacheAttrs::guarded and CPUTLBEntryFull::extra::arm::guarded), and we were storing the GP bit in the latter during the stage 1 walk but trying to copy the former in combine_cacheattrs(). Remove the duplicated storage, and always use the field in CPUTLBEntryFull; correctly propagate the stage 1 value to the output in get_phys_addr_twostage(). Note for stable backports: in v8.0 and earlier the field is named result->f.guarded, not result->f.extra.arm.guarded. Cc: qemu-stable@nongnu.org Resolves: https://gitlab.com/qemu-project/qemu/-/issues/1950 Signed-off-by: Peter Maydell Reviewed-by: Richard Henderson Message-id: 20231031173723.26582-1-peter.maydell@linaro.org --- target/arm/internals.h | 1 - target/arm/ptw.c | 7 +++++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/target/arm/internals.h b/target/arm/internals.h index f7224e6f4d9..c837506e448 100644 --- a/target/arm/internals.h +++ b/target/arm/internals.h @@ -1181,7 +1181,6 @@ typedef struct ARMCacheAttrs { unsigned int attrs:8; unsigned int shareability:2; /* as in the SH field of the VMSAv8-64 PTEs */ bool is_s2_format:1; - bool guarded:1; /* guarded bit of the v8-64 PTE */ } ARMCacheAttrs; /* Fields that are valid upon success. */ diff --git a/target/arm/ptw.c b/target/arm/ptw.c index 53713e03006..1762b058aec 100644 --- a/target/arm/ptw.c +++ b/target/arm/ptw.c @@ -3032,7 +3032,6 @@ static ARMCacheAttrs combine_cacheattrs(uint64_t hcr, assert(!s1.is_s2_format); ret.is_s2_format = false; - ret.guarded = s1.guarded; if (s1.attrs == 0xf0) { tagged = true; @@ -3175,7 +3174,7 @@ static bool get_phys_addr_twostage(CPUARMState *env, S1Translate *ptw, hwaddr ipa; int s1_prot, s1_lgpgsz; ARMSecuritySpace in_space = ptw->in_space; - bool ret, ipa_secure; + bool ret, ipa_secure, s1_guarded; ARMCacheAttrs cacheattrs1; ARMSecuritySpace ipa_space; uint64_t hcr; @@ -3202,6 +3201,7 @@ static bool get_phys_addr_twostage(CPUARMState *env, S1Translate *ptw, */ s1_prot = result->f.prot; s1_lgpgsz = result->f.lg_page_size; + s1_guarded = result->f.extra.arm.guarded; cacheattrs1 = result->cacheattrs; memset(result, 0, sizeof(*result)); @@ -3252,6 +3252,9 @@ static bool get_phys_addr_twostage(CPUARMState *env, S1Translate *ptw, result->cacheattrs = combine_cacheattrs(hcr, cacheattrs1, result->cacheattrs); + /* No BTI GP information in stage 2, we just use the S1 value */ + result->f.extra.arm.guarded = s1_guarded; + /* * Check if IPA translates to secure or non-secure PA space. * Note that VSTCR overrides VTCR and {N}SW overrides {N}SA. From patchwork Thu Nov 2 17:38:33 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 740458 Delivered-To: patch@linaro.org Received: by 2002:a5d:538f:0:b0:32d:baff:b0ca with SMTP id d15csp962072wrv; Thu, 2 Nov 2023 10:41:13 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGjzJu69aXWxUBqsG8x8K4jEdSmvLkmIp/vj5WL+eYPRrseQQDb/1XzUmMdvBkIOi2+eGM2 X-Received: by 2002:a05:6808:13d6:b0:3ae:5372:3790 with SMTP id d22-20020a05680813d600b003ae53723790mr21193704oiw.48.1698946873183; Thu, 02 Nov 2023 10:41:13 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1698946873; cv=none; d=google.com; s=arc-20160816; b=muhRb8Qkc3F+QjBAC5O2Bt7h9ALGnW4vO/ZK4ccxQAS281onKJ6h7+Q2cVHFjZ4JIE SIf5Og8rPAhP8pExaOTC+DR062emceiICkJYJ0PoTXsOM2kqw+mchw1Eaf6SOmJGKbsI Jm5IS5JZjr22qV2TlMeSe4mc4dkXCpir/FLNUTmlNYl2j3bMEjUvuB/q0KYfrLM5y0iv tBHGM/RE2hRJocVzOu7qFu+p+6XT/ayyaPbPcnDVKvbAD74vByZEj3CFhcREunmMX1As qRmrtaRGg4s73o92NrgC2xMRhdwAft5VHGpQNTyjxpJHnq/M2ksxRtDYJq2Rh66wxy4i RsIg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:to:from :dkim-signature; bh=p4oAtP21Y7gkFBoqIlI0+xHNguOGQEcOVZ7H9ZVM4yg=; fh=PnYt+qEB9tAfMKoqBm2xjKOFpYyFFGPudh5cVIoieJM=; b=ttMulr/LMqRaC/a6mFqIBWqlK+nAXa+m0I3Cwq/txPUIb3Z85ow4AmVghm6+Igu6GL ga6h9W1hZwWJbc0i7vTv4s44Sz8Q1mQCTeJ4rOAp8/fN1Bhf89DvQQUKX8V9zC4VRnN5 5WaHskMnf7H82528US2eOFNFvyMAficc4lnsBF+c2yZtVshNSoxGY7Th8FjDm1oNfTuL N1bjd2gID5g9kc1ZGZ5Bo3nYZkhjk1a1YQSkPVXXf5GxLD43FoQl1F0Wo+g7vmEibFic vLkEvCHeWRvSvE4NQ00c83WZ0Z/kt/cw8mEeaRQQ8QE/tuI1CCM4ObsR9sB1GmNyL2L8 mqCg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=Rto5nHZx; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id w3-20020a05620a148300b0077894fa3885si254732qkj.268.2023.11.02.10.41.12 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Thu, 02 Nov 2023 10:41:13 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=Rto5nHZx; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qybfJ-0003Xv-Iu; Thu, 02 Nov 2023 13:39:33 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qybel-0003I7-Me for qemu-devel@nongnu.org; Thu, 02 Nov 2023 13:39:00 -0400 Received: from mail-wr1-x430.google.com ([2a00:1450:4864:20::430]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qybeh-0002zM-H1 for qemu-devel@nongnu.org; Thu, 02 Nov 2023 13:38:59 -0400 Received: by mail-wr1-x430.google.com with SMTP id ffacd0b85a97d-32fb1d757f7so299877f8f.0 for ; Thu, 02 Nov 2023 10:38:55 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1698946734; x=1699551534; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:from:to:cc:subject:date:message-id :reply-to; bh=p4oAtP21Y7gkFBoqIlI0+xHNguOGQEcOVZ7H9ZVM4yg=; b=Rto5nHZxVE/GfbYgM2sGK8aEkPeAiSp25+3TiQgJ2f8brEySEYST3vcfy5Y4COiPmW nIN8bq6Fmx3xK5jFOKk8HcAww6ff5esVJwD0BH6wHaWjT3cgPPCbJwYhrlnWLpDlq/LG r1+b18SK+WORjsOf++W1Kcrza4qZqRF427JlrWH9Xb9mK9xfVwI244XFX+fnLwyrbnpL Yqximk2TRziABcGz0dxIuCqj2cEqZ/srsPDy6ANg4/C7tONWUZ4V478LR/pHgHKNqEKW YL+CjPMKRNRVwA6YklS8XS3v9dudoh98Iise7zm+En9b/KCeUj/9mS+7TeNNgY8xAVyS AGaA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1698946734; x=1699551534; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=p4oAtP21Y7gkFBoqIlI0+xHNguOGQEcOVZ7H9ZVM4yg=; b=srcAwp7ENE1gOevQlNX+0QAzGKm1bKcjH3yAnkC7BYNf+lSHbrU1VX5BSh6rfWhVlG 4b2sCD0rKnLMnQi6ryK+H+R+N5zkJe2XFf8A4OhcQFHAkVM53EgeGzJFYEzwPRVvi4g+ RwfKKzWBxeRfLJQaSAZ3ZiwS9Mjy6dWqyT54IG4YQdIUUEVR3F4H8ulgLRiAGY9xOcvY YJmRY4D65Ks7D+Si+M4dXz0Jm3YqgYG1rcydmLyu50sQQCwuxDizkJP6jf4pIaN2a0Ff F3VpWPA1j9j0yt2m8A19Y7OnJyD6+whOde5PpeOFOIT3RJOut/jwZzk88cioRITXEKz1 Zd6g== X-Gm-Message-State: AOJu0YyR8ldcs2W1E60X7EKJn6f+X9XWVMskbkg7hR2MTAzywTA3fhFY /eEXFgL2Tt12oivJ29cLZ3wTquugHRNr+bvSqMo= X-Received: by 2002:a5d:6f1a:0:b0:32d:b2cf:8ccd with SMTP id ay26-20020a5d6f1a000000b0032db2cf8ccdmr24288133wrb.47.1698946734044; Thu, 02 Nov 2023 10:38:54 -0700 (PDT) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [2001:8b0:1d0::2]) by smtp.gmail.com with ESMTPSA id e16-20020adff350000000b003258934a4bcsm3046805wrp.42.2023.11.02.10.38.53 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 02 Nov 2023 10:38:53 -0700 (PDT) From: Peter Maydell To: qemu-devel@nongnu.org Subject: [PULL 31/33] hw/misc: Introduce AMD/Xilix Versal TRNG device Date: Thu, 2 Nov 2023 17:38:33 +0000 Message-Id: <20231102173835.609985-32-peter.maydell@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231102173835.609985-1-peter.maydell@linaro.org> References: <20231102173835.609985-1-peter.maydell@linaro.org> MIME-Version: 1.0 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, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org From: Tong Ho This adds a non-cryptographic grade implementation of the model for the True Random Number Generator (TRNG) component in AMD/Xilinx Versal device family. This implements all 3 modes defined by the actual hardware specs, all of which selectable by guest software at will at anytime: 1) PRNG mode, in which the generated sequence is required to be reproducible after reseeded by the same 384-bit value as supplied by guest software. 2) Test mode, in which the generated sequence is required to be reproducible ater reseeded by the same 128-bit test seed supplied by guest software. 3) TRNG mode, in which non-reproducible sequence is generated based on periodic reseed by a suitable entropy source. This model is only intended for non-real world testing of guest software, where cryptographically strong PRNG or TRNG is not needed. This model supports versions 1 & 2 of the device, with default to be version 2; the 'hw-version' uint32 property can be set to 0x0100 to override the default. Other implemented properties: - 'forced-prng', uint64 When set to non-zero, mode 3's entropy source is implemented as a deterministic sequence based on the given value and other deterministic parameters. This option allows the emulation to test guest software using mode 3 and to reproduce data-dependent defects. - 'fips-fault-events', uint32, bit-mask bit 3: Triggers the SP800-90B entropy health test fault irq bit 1: Triggers the FIPS 140-2 continuous test fault irq Signed-off-by: Tong Ho Message-id: 20231031184611.3029156-2-tong.ho@amd.com Reviewed-by: Peter Maydell Signed-off-by: Peter Maydell --- include/hw/misc/xlnx-versal-trng.h | 58 +++ hw/misc/xlnx-versal-trng.c | 717 +++++++++++++++++++++++++++++ hw/misc/Kconfig | 3 + hw/misc/meson.build | 3 + 4 files changed, 781 insertions(+) create mode 100644 include/hw/misc/xlnx-versal-trng.h create mode 100644 hw/misc/xlnx-versal-trng.c diff --git a/include/hw/misc/xlnx-versal-trng.h b/include/hw/misc/xlnx-versal-trng.h new file mode 100644 index 00000000000..0bcef8a6132 --- /dev/null +++ b/include/hw/misc/xlnx-versal-trng.h @@ -0,0 +1,58 @@ +/* + * Non-crypto strength model of the True Random Number Generator + * in the AMD/Xilinx Versal device family. + * + * Copyright (c) 2017-2020 Xilinx Inc. + * Copyright (c) 2023 Advanced Micro Devices, Inc. + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + */ +#ifndef XLNX_VERSAL_TRNG_H +#define XLNX_VERSAL_TRNG_H + +#include "hw/irq.h" +#include "hw/sysbus.h" +#include "hw/register.h" + +#define TYPE_XLNX_VERSAL_TRNG "xlnx.versal-trng" +OBJECT_DECLARE_SIMPLE_TYPE(XlnxVersalTRng, XLNX_VERSAL_TRNG); + +#define RMAX_XLNX_VERSAL_TRNG ((0xf0 / 4) + 1) + +typedef struct XlnxVersalTRng { + SysBusDevice parent_obj; + qemu_irq irq; + GRand *prng; + + uint32_t hw_version; + uint32_t forced_faults; + + uint32_t rand_count; + uint64_t rand_reseed; + + uint64_t forced_prng_seed; + uint64_t forced_prng_count; + uint64_t tst_seed[2]; + + uint32_t regs[RMAX_XLNX_VERSAL_TRNG]; + RegisterInfo regs_info[RMAX_XLNX_VERSAL_TRNG]; +} XlnxVersalTRng; + +#undef RMAX_XLNX_VERSAL_TRNG +#endif diff --git a/hw/misc/xlnx-versal-trng.c b/hw/misc/xlnx-versal-trng.c new file mode 100644 index 00000000000..4d41c262c48 --- /dev/null +++ b/hw/misc/xlnx-versal-trng.c @@ -0,0 +1,717 @@ +/* + * Non-crypto strength model of the True Random Number Generator + * in the AMD/Xilinx Versal device family. + * + * Copyright (c) 2017-2020 Xilinx Inc. + * Copyright (c) 2023 Advanced Micro Devices, Inc. + * + * Written by Edgar E. Iglesias + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + */ +#include "qemu/osdep.h" +#include "hw/misc/xlnx-versal-trng.h" + +#include "qemu/bitops.h" +#include "qemu/log.h" +#include "qemu/error-report.h" +#include "qemu/guest-random.h" +#include "qemu/timer.h" +#include "qapi/visitor.h" +#include "migration/vmstate.h" +#include "hw/qdev-properties.h" + +#ifndef XLNX_VERSAL_TRNG_ERR_DEBUG +#define XLNX_VERSAL_TRNG_ERR_DEBUG 0 +#endif + +REG32(INT_CTRL, 0x0) + FIELD(INT_CTRL, CERTF_RST, 5, 1) + FIELD(INT_CTRL, DTF_RST, 4, 1) + FIELD(INT_CTRL, DONE_RST, 3, 1) + FIELD(INT_CTRL, CERTF_EN, 2, 1) + FIELD(INT_CTRL, DTF_EN, 1, 1) + FIELD(INT_CTRL, DONE_EN, 0, 1) +REG32(STATUS, 0x4) + FIELD(STATUS, QCNT, 9, 3) + FIELD(STATUS, EAT, 4, 5) + FIELD(STATUS, CERTF, 3, 1) + FIELD(STATUS, DTF, 1, 1) + FIELD(STATUS, DONE, 0, 1) +REG32(CTRL, 0x8) + FIELD(CTRL, PERSODISABLE, 10, 1) + FIELD(CTRL, SINGLEGENMODE, 9, 1) + FIELD(CTRL, EUMODE, 8, 1) + FIELD(CTRL, PRNGMODE, 7, 1) + FIELD(CTRL, TSTMODE, 6, 1) + FIELD(CTRL, PRNGSTART, 5, 1) + FIELD(CTRL, EATAU, 4, 1) + FIELD(CTRL, PRNGXS, 3, 1) + FIELD(CTRL, TRSSEN, 2, 1) + FIELD(CTRL, QERTUEN, 1, 1) + FIELD(CTRL, PRNGSRST, 0, 1) +REG32(CTRL_2, 0xc) + FIELD(CTRL_2, REPCOUNTTESTCUTOFF, 8, 9) + FIELD(CTRL_2, RESERVED_7_5, 5, 3) + FIELD(CTRL_2, DIT, 0, 5) +REG32(CTRL_3, 0x10) + FIELD(CTRL_3, ADAPTPROPTESTCUTOFF, 8, 10) + FIELD(CTRL_3, DLEN, 0, 8) +REG32(CTRL_4, 0x14) + FIELD(CTRL_4, SINGLEBITRAW, 0, 1) +REG32(EXT_SEED_0, 0x40) +REG32(EXT_SEED_1, 0x44) +REG32(EXT_SEED_2, 0x48) +REG32(EXT_SEED_3, 0x4c) +REG32(EXT_SEED_4, 0x50) +REG32(EXT_SEED_5, 0x54) +REG32(EXT_SEED_6, 0x58) +REG32(EXT_SEED_7, 0x5c) +REG32(EXT_SEED_8, 0x60) +REG32(EXT_SEED_9, 0x64) +REG32(EXT_SEED_10, 0x68) +REG32(EXT_SEED_11, 0x6c) +REG32(PER_STRNG_0, 0x80) +REG32(PER_STRNG_1, 0x84) +REG32(PER_STRNG_2, 0x88) +REG32(PER_STRNG_3, 0x8c) +REG32(PER_STRNG_4, 0x90) +REG32(PER_STRNG_5, 0x94) +REG32(PER_STRNG_6, 0x98) +REG32(PER_STRNG_7, 0x9c) +REG32(PER_STRNG_8, 0xa0) +REG32(PER_STRNG_9, 0xa4) +REG32(PER_STRNG_10, 0xa8) +REG32(PER_STRNG_11, 0xac) +REG32(CORE_OUTPUT, 0xc0) +REG32(RESET, 0xd0) + FIELD(RESET, VAL, 0, 1) +REG32(OSC_EN, 0xd4) + FIELD(OSC_EN, VAL, 0, 1) +REG32(TRNG_ISR, 0xe0) + FIELD(TRNG_ISR, SLVERR, 1, 1) + FIELD(TRNG_ISR, CORE_INT, 0, 1) +REG32(TRNG_IMR, 0xe4) + FIELD(TRNG_IMR, SLVERR, 1, 1) + FIELD(TRNG_IMR, CORE_INT, 0, 1) +REG32(TRNG_IER, 0xe8) + FIELD(TRNG_IER, SLVERR, 1, 1) + FIELD(TRNG_IER, CORE_INT, 0, 1) +REG32(TRNG_IDR, 0xec) + FIELD(TRNG_IDR, SLVERR, 1, 1) + FIELD(TRNG_IDR, CORE_INT, 0, 1) +REG32(SLV_ERR_CTRL, 0xf0) + FIELD(SLV_ERR_CTRL, ENABLE, 0, 1) + +#define R_MAX (R_SLV_ERR_CTRL + 1) + +QEMU_BUILD_BUG_ON(R_MAX * 4 != sizeof_field(XlnxVersalTRng, regs)); + +#define TRNG_GUEST_ERROR(D, FMT, ...) \ + do { \ + g_autofree char *p = object_get_canonical_path(OBJECT(D)); \ + qemu_log_mask(LOG_GUEST_ERROR, "%s: " FMT, p, ## __VA_ARGS__); \ + } while (0) + +#define TRNG_WARN(D, FMT, ...) \ + do { \ + g_autofree char *p = object_get_canonical_path(OBJECT(D)); \ + warn_report("%s: " FMT, p, ## __VA_ARGS__); \ + } while (0) + +static bool trng_older_than_v2(XlnxVersalTRng *s) +{ + return s->hw_version < 0x0200; +} + +static bool trng_in_reset(XlnxVersalTRng *s) +{ + if (ARRAY_FIELD_EX32(s->regs, RESET, VAL)) { + return true; + } + if (ARRAY_FIELD_EX32(s->regs, CTRL, PRNGSRST)) { + return true; + } + + return false; +} + +static bool trng_test_enabled(XlnxVersalTRng *s) +{ + return ARRAY_FIELD_EX32(s->regs, CTRL, TSTMODE); +} + +static bool trng_trss_enabled(XlnxVersalTRng *s) +{ + if (trng_in_reset(s)) { + return false; + } + if (!ARRAY_FIELD_EX32(s->regs, CTRL, TRSSEN)) { + return false; + } + if (!ARRAY_FIELD_EX32(s->regs, OSC_EN, VAL)) { + return false; + } + + return true; +} + +static void trng_seed_128(uint32_t *seed, uint64_t h00, uint64_t h64) +{ + seed[0] = extract64(h00, 0, 32); + seed[1] = extract64(h00, 32, 32); + seed[2] = extract64(h64, 0, 32); + seed[3] = extract64(h64, 32, 32); +} + +static void trng_reseed(XlnxVersalTRng *s) +{ + bool ext_seed = ARRAY_FIELD_EX32(s->regs, CTRL, PRNGXS); + bool pers_disabled = ARRAY_FIELD_EX32(s->regs, CTRL, PERSODISABLE); + + enum { + U384_U8 = 384 / 8, + U384_U32 = 384 / 32, + }; + + /* + * Maximum seed length is len(personalized string) + len(ext seed). + * + * g_rand_set_seed_array() takes array of uint32 in host endian. + */ + guint32 gs[U384_U32 * 2], *seed = &gs[U384_U32]; + + /* + * A disabled personalized string is the same as + * a string with all zeros. + * + * The device's hardware spec defines 3 modes (all selectable + * by guest at will and at anytime): + * 1) External seeding + * This is a PRNG mode, in which the produced sequence shall + * be reproducible if reseeded by the same 384-bit seed, as + * supplied by guest software. + * 2) Test seeding + * This is a PRNG mode, in which the produced sequence shall + * be reproducible if reseeded by a 128-bit test seed, as + * supplied by guest software. + * 3) Truly-random seeding + * This is the TRNG mode, in which the produced sequence is + * periodically reseeded by a crypto-strength entropy source. + * + * To assist debugging of certain classes of software defects, + * this QEMU model implements a 4th mode, + * 4) Forced PRNG + * When in this mode, a reproducible sequence is generated + * if software has selected the TRNG mode (mode 2). + * + * This emulation-only mode can only be selected by setting + * the uint64 property 'forced-prng' to a non-zero value. + * Guest software cannot select this mode. + */ + memset(gs, 0, sizeof(gs)); + + if (!pers_disabled) { + memcpy(gs, &s->regs[R_PER_STRNG_0], U384_U8); + } + + if (ext_seed) { + memcpy(seed, &s->regs[R_EXT_SEED_0], U384_U8); + } else if (trng_test_enabled(s)) { + trng_seed_128(seed, s->tst_seed[0], s->tst_seed[1]); + } else if (s->forced_prng_seed) { + s->forced_prng_count++; + trng_seed_128(seed, s->forced_prng_count, s->forced_prng_seed); + } else { + qemu_guest_getrandom_nofail(seed, U384_U8); + } + + g_rand_set_seed_array(s->prng, gs, ARRAY_SIZE(gs)); + + s->rand_count = 0; + s->rand_reseed = 1ULL << 48; +} + +static void trng_regen(XlnxVersalTRng *s) +{ + if (s->rand_reseed == 0) { + TRNG_GUEST_ERROR(s, "Too many generations without a reseed"); + trng_reseed(s); + } + s->rand_reseed--; + + /* + * In real hardware, each regen creates 256 bits, but QCNT + * reports a max of 4. + */ + ARRAY_FIELD_DP32(s->regs, STATUS, QCNT, 4); + s->rand_count = 256 / 32; +} + +static uint32_t trng_rdout(XlnxVersalTRng *s) +{ + assert(s->rand_count); + + s->rand_count--; + if (s->rand_count < 4) { + ARRAY_FIELD_DP32(s->regs, STATUS, QCNT, s->rand_count); + } + + return g_rand_int(s->prng); +} + +static void trng_irq_update(XlnxVersalTRng *s) +{ + bool pending = s->regs[R_TRNG_ISR] & ~s->regs[R_TRNG_IMR]; + qemu_set_irq(s->irq, pending); +} + +static void trng_isr_postw(RegisterInfo *reg, uint64_t val64) +{ + XlnxVersalTRng *s = XLNX_VERSAL_TRNG(reg->opaque); + trng_irq_update(s); +} + +static uint64_t trng_ier_prew(RegisterInfo *reg, uint64_t val64) +{ + XlnxVersalTRng *s = XLNX_VERSAL_TRNG(reg->opaque); + uint32_t val = val64; + + s->regs[R_TRNG_IMR] &= ~val; + trng_irq_update(s); + return 0; +} + +static uint64_t trng_idr_prew(RegisterInfo *reg, uint64_t val64) +{ + XlnxVersalTRng *s = XLNX_VERSAL_TRNG(reg->opaque); + uint32_t val = val64; + + s->regs[R_TRNG_IMR] |= val; + trng_irq_update(s); + return 0; +} + +static void trng_core_int_update(XlnxVersalTRng *s) +{ + bool pending = false; + uint32_t st = s->regs[R_STATUS]; + uint32_t en = s->regs[R_INT_CTRL]; + + if (FIELD_EX32(st, STATUS, CERTF) && FIELD_EX32(en, INT_CTRL, CERTF_EN)) { + pending = true; + } + + if (FIELD_EX32(st, STATUS, DTF) && FIELD_EX32(en, INT_CTRL, DTF_EN)) { + pending = true; + } + + if (FIELD_EX32(st, STATUS, DONE) && FIELD_EX32(en, INT_CTRL, DONE_EN)) { + pending = true; + } + + ARRAY_FIELD_DP32(s->regs, TRNG_ISR, CORE_INT, pending); + trng_irq_update(s); +} + +static void trng_int_ctrl_postw(RegisterInfo *reg, uint64_t val64) +{ + XlnxVersalTRng *s = XLNX_VERSAL_TRNG(reg->opaque); + uint32_t v32 = val64; + uint32_t clr_mask = 0; + + if (FIELD_EX32(v32, INT_CTRL, CERTF_RST)) { + clr_mask |= R_STATUS_CERTF_MASK; + } + if (FIELD_EX32(v32, INT_CTRL, DTF_RST)) { + clr_mask |= R_STATUS_DTF_MASK; + } + if (FIELD_EX32(v32, INT_CTRL, DONE_RST)) { + clr_mask |= R_STATUS_DONE_MASK; + } + + s->regs[R_STATUS] &= ~clr_mask; + trng_core_int_update(s); +} + +static void trng_done(XlnxVersalTRng *s) +{ + ARRAY_FIELD_DP32(s->regs, STATUS, DONE, true); + trng_core_int_update(s); +} + +static void trng_fault_event_set(XlnxVersalTRng *s, uint32_t events) +{ + bool pending = false; + + /* Disabled TRSS cannot generate any fault event */ + if (!trng_trss_enabled(s)) { + return; + } + + if (FIELD_EX32(events, STATUS, CERTF)) { + /* In older version, ERTU must be enabled explicitly to get CERTF */ + if (trng_older_than_v2(s) && + !ARRAY_FIELD_EX32(s->regs, CTRL, QERTUEN)) { + TRNG_WARN(s, "CERTF injection ignored: ERTU disabled"); + } else { + ARRAY_FIELD_DP32(s->regs, STATUS, CERTF, true); + pending = true; + } + } + + if (FIELD_EX32(events, STATUS, DTF)) { + ARRAY_FIELD_DP32(s->regs, STATUS, DTF, true); + pending = true; + } + + if (pending) { + trng_core_int_update(s); + } +} + +static void trng_soft_reset(XlnxVersalTRng *s) +{ + s->rand_count = 0; + s->regs[R_STATUS] = 0; + + ARRAY_FIELD_DP32(s->regs, TRNG_ISR, CORE_INT, 0); +} + +static void trng_ctrl_postw(RegisterInfo *reg, uint64_t val64) +{ + XlnxVersalTRng *s = XLNX_VERSAL_TRNG(reg->opaque); + + if (trng_in_reset(s)) { + return; + } + + if (FIELD_EX32(val64, CTRL, PRNGSRST)) { + trng_soft_reset(s); + trng_irq_update(s); + return; + } + + if (!FIELD_EX32(val64, CTRL, PRNGSTART)) { + return; + } + + if (FIELD_EX32(val64, CTRL, PRNGMODE)) { + trng_regen(s); + } else { + trng_reseed(s); + } + + trng_done(s); +} + +static void trng_ctrl4_postw(RegisterInfo *reg, uint64_t val64) +{ + XlnxVersalTRng *s = XLNX_VERSAL_TRNG(reg->opaque); + + /* Only applies to test mode with TRSS enabled */ + if (!trng_test_enabled(s) || !trng_trss_enabled(s)) { + return; + } + + /* Shift in a single bit. */ + s->tst_seed[1] <<= 1; + s->tst_seed[1] |= s->tst_seed[0] >> 63; + s->tst_seed[0] <<= 1; + s->tst_seed[0] |= val64 & 1; + + trng_reseed(s); + trng_regen(s); +} + +static uint64_t trng_core_out_postr(RegisterInfo *reg, uint64_t val) +{ + XlnxVersalTRng *s = XLNX_VERSAL_TRNG(reg->opaque); + bool oneshot = ARRAY_FIELD_EX32(s->regs, CTRL, SINGLEGENMODE); + bool start = ARRAY_FIELD_EX32(s->regs, CTRL, PRNGSTART); + uint32_t r = 0xbad; + + if (trng_in_reset(s)) { + TRNG_GUEST_ERROR(s, "Reading random number while in reset!"); + return r; + } + + if (s->rand_count == 0) { + TRNG_GUEST_ERROR(s, "Reading random number when unavailable!"); + return r; + } + + r = trng_rdout(s); + + /* Automatic mode regenerates when half the output reg is empty. */ + if (!oneshot && start && s->rand_count <= 3) { + trng_regen(s); + } + + return r; +} + +static void trng_reset(XlnxVersalTRng *s) +{ + unsigned int i; + + s->forced_prng_count = 0; + + for (i = 0; i < ARRAY_SIZE(s->regs_info); ++i) { + register_reset(&s->regs_info[i]); + } + trng_soft_reset(s); + trng_irq_update(s); +} + +static uint64_t trng_reset_prew(RegisterInfo *reg, uint64_t val64) +{ + XlnxVersalTRng *s = XLNX_VERSAL_TRNG(reg->opaque); + + if (!ARRAY_FIELD_EX32(s->regs, RESET, VAL) && + FIELD_EX32(val64, RESET, VAL)) { + trng_reset(s); + } + + return val64; +} + +static uint64_t trng_register_read(void *opaque, hwaddr addr, unsigned size) +{ + /* + * Guest provided seed and personalized strings cannot be + * read back, and read attempts return value of A_STATUS. + */ + switch (addr) { + case A_EXT_SEED_0 ... A_PER_STRNG_11: + addr = A_STATUS; + break; + } + + return register_read_memory(opaque, addr, size); +} + +static void trng_register_write(void *opaque, hwaddr addr, + uint64_t value, unsigned size) +{ + RegisterInfoArray *reg_array = opaque; + XlnxVersalTRng *s = XLNX_VERSAL_TRNG(reg_array->r[0]->opaque); + + if (trng_older_than_v2(s)) { + switch (addr) { + case A_CTRL: + value = FIELD_DP64(value, CTRL, PERSODISABLE, 0); + value = FIELD_DP64(value, CTRL, SINGLEGENMODE, 0); + break; + case A_CTRL_2: + case A_CTRL_3: + case A_CTRL_4: + return; + } + } else { + switch (addr) { + case A_CTRL: + value = FIELD_DP64(value, CTRL, EATAU, 0); + value = FIELD_DP64(value, CTRL, QERTUEN, 0); + break; + } + } + + register_write_memory(opaque, addr, value, size); +} + +static RegisterAccessInfo trng_regs_info[] = { + { .name = "INT_CTRL", .addr = A_INT_CTRL, + .post_write = trng_int_ctrl_postw, + },{ .name = "STATUS", .addr = A_STATUS, + .ro = 0xfff, + },{ .name = "CTRL", .addr = A_CTRL, + .post_write = trng_ctrl_postw, + },{ .name = "CTRL_2", .addr = A_CTRL_2, + .reset = 0x210c, + },{ .name = "CTRL_3", .addr = A_CTRL_3, + .reset = 0x26f09, + },{ .name = "CTRL_4", .addr = A_CTRL_4, + .post_write = trng_ctrl4_postw, + },{ .name = "EXT_SEED_0", .addr = A_EXT_SEED_0, + },{ .name = "EXT_SEED_1", .addr = A_EXT_SEED_1, + },{ .name = "EXT_SEED_2", .addr = A_EXT_SEED_2, + },{ .name = "EXT_SEED_3", .addr = A_EXT_SEED_3, + },{ .name = "EXT_SEED_4", .addr = A_EXT_SEED_4, + },{ .name = "EXT_SEED_5", .addr = A_EXT_SEED_5, + },{ .name = "EXT_SEED_6", .addr = A_EXT_SEED_6, + },{ .name = "EXT_SEED_7", .addr = A_EXT_SEED_7, + },{ .name = "EXT_SEED_8", .addr = A_EXT_SEED_8, + },{ .name = "EXT_SEED_9", .addr = A_EXT_SEED_9, + },{ .name = "EXT_SEED_10", .addr = A_EXT_SEED_10, + },{ .name = "EXT_SEED_11", .addr = A_EXT_SEED_11, + },{ .name = "PER_STRNG_0", .addr = A_PER_STRNG_0, + },{ .name = "PER_STRNG_1", .addr = A_PER_STRNG_1, + },{ .name = "PER_STRNG_2", .addr = A_PER_STRNG_2, + },{ .name = "PER_STRNG_3", .addr = A_PER_STRNG_3, + },{ .name = "PER_STRNG_4", .addr = A_PER_STRNG_4, + },{ .name = "PER_STRNG_5", .addr = A_PER_STRNG_5, + },{ .name = "PER_STRNG_6", .addr = A_PER_STRNG_6, + },{ .name = "PER_STRNG_7", .addr = A_PER_STRNG_7, + },{ .name = "PER_STRNG_8", .addr = A_PER_STRNG_8, + },{ .name = "PER_STRNG_9", .addr = A_PER_STRNG_9, + },{ .name = "PER_STRNG_10", .addr = A_PER_STRNG_10, + },{ .name = "PER_STRNG_11", .addr = A_PER_STRNG_11, + },{ .name = "CORE_OUTPUT", .addr = A_CORE_OUTPUT, + .ro = 0xffffffff, + .post_read = trng_core_out_postr, + },{ .name = "RESET", .addr = A_RESET, + .reset = 0x1, + .pre_write = trng_reset_prew, + },{ .name = "OSC_EN", .addr = A_OSC_EN, + },{ .name = "TRNG_ISR", .addr = A_TRNG_ISR, + .w1c = 0x3, + .post_write = trng_isr_postw, + },{ .name = "TRNG_IMR", .addr = A_TRNG_IMR, + .reset = 0x3, + .ro = 0x3, + },{ .name = "TRNG_IER", .addr = A_TRNG_IER, + .pre_write = trng_ier_prew, + },{ .name = "TRNG_IDR", .addr = A_TRNG_IDR, + .pre_write = trng_idr_prew, + },{ .name = "SLV_ERR_CTRL", .addr = A_SLV_ERR_CTRL, + } +}; + +static const MemoryRegionOps trng_ops = { + .read = trng_register_read, + .write = trng_register_write, + .endianness = DEVICE_LITTLE_ENDIAN, + .valid = { + .min_access_size = 4, + .max_access_size = 4, + }, +}; + +static void trng_init(Object *obj) +{ + XlnxVersalTRng *s = XLNX_VERSAL_TRNG(obj); + SysBusDevice *sbd = SYS_BUS_DEVICE(obj); + RegisterInfoArray *reg_array; + + reg_array = + register_init_block32(DEVICE(obj), trng_regs_info, + ARRAY_SIZE(trng_regs_info), + s->regs_info, s->regs, + &trng_ops, + XLNX_VERSAL_TRNG_ERR_DEBUG, + R_MAX * 4); + + sysbus_init_mmio(sbd, ®_array->mem); + sysbus_init_irq(sbd, &s->irq); + + s->prng = g_rand_new(); +} + +static void trng_unrealize(DeviceState *dev) +{ + XlnxVersalTRng *s = XLNX_VERSAL_TRNG(dev); + + g_rand_free(s->prng); + s->prng = NULL; +} + +static void trng_reset_hold(Object *obj) +{ + trng_reset(XLNX_VERSAL_TRNG(obj)); +} + +static void trng_prop_fault_event_set(Object *obj, Visitor *v, + const char *name, void *opaque, + Error **errp) +{ + Property *prop = opaque; + uint32_t *events = object_field_prop_ptr(obj, prop); + + visit_type_uint32(v, name, events, errp); + if (*errp) { + return; + } + + trng_fault_event_set(XLNX_VERSAL_TRNG(obj), *events); +} + +static const PropertyInfo trng_prop_fault_events = { + .name = "uint32:bits", + .description = "Set to trigger TRNG fault events", + .set = trng_prop_fault_event_set, + .realized_set_allowed = true, +}; + +static PropertyInfo trng_prop_uint64; /* to extend qdev_prop_uint64 */ + +static Property trng_props[] = { + DEFINE_PROP_UINT64("forced-prng", XlnxVersalTRng, forced_prng_seed, 0), + DEFINE_PROP_UINT32("hw-version", XlnxVersalTRng, hw_version, 0x0200), + DEFINE_PROP("fips-fault-events", XlnxVersalTRng, forced_faults, + trng_prop_fault_events, uint32_t), + + DEFINE_PROP_END_OF_LIST(), +}; + +static const VMStateDescription vmstate_trng = { + .name = TYPE_XLNX_VERSAL_TRNG, + .version_id = 1, + .minimum_version_id = 1, + .fields = (VMStateField[]) { + VMSTATE_UINT32(rand_count, XlnxVersalTRng), + VMSTATE_UINT64(rand_reseed, XlnxVersalTRng), + VMSTATE_UINT64(forced_prng_count, XlnxVersalTRng), + VMSTATE_UINT64_ARRAY(tst_seed, XlnxVersalTRng, 2), + VMSTATE_UINT32_ARRAY(regs, XlnxVersalTRng, R_MAX), + VMSTATE_END_OF_LIST(), + } +}; + +static void trng_class_init(ObjectClass *klass, void *data) +{ + DeviceClass *dc = DEVICE_CLASS(klass); + ResettableClass *rc = RESETTABLE_CLASS(klass); + + dc->vmsd = &vmstate_trng; + dc->unrealize = trng_unrealize; + rc->phases.hold = trng_reset_hold; + + /* Clone uint64 property with set allowed after realized */ + trng_prop_uint64 = qdev_prop_uint64; + trng_prop_uint64.realized_set_allowed = true; + trng_props[0].info = &trng_prop_uint64; + + device_class_set_props(dc, trng_props); +} + +static const TypeInfo trng_info = { + .name = TYPE_XLNX_VERSAL_TRNG, + .parent = TYPE_SYS_BUS_DEVICE, + .instance_size = sizeof(XlnxVersalTRng), + .class_init = trng_class_init, + .instance_init = trng_init, +}; + +static void trng_register_types(void) +{ + type_register_static(&trng_info); +} + +type_init(trng_register_types) diff --git a/hw/misc/Kconfig b/hw/misc/Kconfig index dba41afe676..cc8a8c1418f 100644 --- a/hw/misc/Kconfig +++ b/hw/misc/Kconfig @@ -197,4 +197,7 @@ config DJMEMC config IOSB bool +config XLNX_VERSAL_TRNG + bool + source macio/Kconfig diff --git a/hw/misc/meson.build b/hw/misc/meson.build index f60de33f9af..36c20d5637f 100644 --- a/hw/misc/meson.build +++ b/hw/misc/meson.build @@ -104,6 +104,9 @@ system_ss.add(when: 'CONFIG_XLNX_VERSAL', if_true: files( 'xlnx-cfi-if.c', 'xlnx-versal-cframe-reg.c', )) +system_ss.add(when: 'CONFIG_XLNX_VERSAL_TRNG', if_true: files( + 'xlnx-versal-trng.c', +)) system_ss.add(when: 'CONFIG_STM32F2XX_SYSCFG', if_true: files('stm32f2xx_syscfg.c')) system_ss.add(when: 'CONFIG_STM32F4XX_SYSCFG', if_true: files('stm32f4xx_syscfg.c')) system_ss.add(when: 'CONFIG_STM32F4XX_EXTI', if_true: files('stm32f4xx_exti.c')) From patchwork Thu Nov 2 17:38:34 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 740453 Delivered-To: patch@linaro.org Received: by 2002:a5d:538f:0:b0:32d:baff:b0ca with SMTP id d15csp961908wrv; Thu, 2 Nov 2023 10:40:52 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHZTQxP3b4BqbUm/dxzVQNZ3C2ex7QCNC1kOl83Jx/g8zDl4vbrzHIjznGRgM8KhjxhXg64 X-Received: by 2002:ac8:598d:0:b0:417:b91b:e101 with SMTP id e13-20020ac8598d000000b00417b91be101mr23592867qte.21.1698946851836; Thu, 02 Nov 2023 10:40:51 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1698946851; cv=none; d=google.com; s=arc-20160816; b=PFWFfTyB5poKFbAeFgNNz3UzamgUgEFL8denQ8A2xVQqmpH9vAc9phRXlSjKPh0p1i sN++14WkSRR3cWipwOiTm4RUPe1GlUZGvZ0bXaI18Ojh5E+kx/5mF2qLFJcSCD+u8+O1 S/et9cWOMW4lKEAIauQtCGDiRL60zFYDL1Ijcf81QohXcAomv0r6TgLBzpaXDoplVsKA qJIUK7pt1bOPXWubAQwu4+7Yq79cKkwCs/Vgk58eIa36oJXBYmH9uwgRHtSsRFhzmPJ9 o2OQOPeB2m6K82FQddDtLFbg+ltw8q4UylMvPb98jcqVzRoVPhCUtFUTeXrtZSOjX+9l UXGQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:to:from :dkim-signature; bh=bw+NalypwIx1j4sKRcT1ebbMc0jvSR3eUfnw2LvsKB0=; fh=PnYt+qEB9tAfMKoqBm2xjKOFpYyFFGPudh5cVIoieJM=; b=yWWlW+hNzzSj5A4n78puPCbU6vgZK0L+z1P6S0Nh39uWPchEEYuQ9svoHpIAlZ+JCf SzaDcoZ45OpFyDZcFRx43erWdeMRwnF+qMVP2xL+XJdxX512t0XjyE7QIXI7FX9zgT/+ eykI/Cxyu48u3oaftL0C96HAyFZ291kwHCVyLsB0rBo99NEmaBKdO1QmcI5w5RK5AzDr zrWPnCgNrh6gEwQ2CHUQe0kmZrB+8D5oMkNVlNQzmIIALJnTRUVxITVW8jtL3qD+b8Ts aN8jLd2anj4lCt1RYMiI/f1zcip6kDy5FAWUbjFn4Esxwkos0Xn5Ml6EkH4+iG83HezU 4Auw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=a3HAL3CQ; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id c8-20020a05622a024800b0041cbd6fe795si306723qtx.22.2023.11.02.10.40.51 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Thu, 02 Nov 2023 10:40:51 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=a3HAL3CQ; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qybfM-0003gi-SZ; Thu, 02 Nov 2023 13:39:37 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qybek-0003Hj-8G for qemu-devel@nongnu.org; Thu, 02 Nov 2023 13:39:00 -0400 Received: from mail-wm1-x32c.google.com ([2a00:1450:4864:20::32c]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qybei-0002zi-4N for qemu-devel@nongnu.org; Thu, 02 Nov 2023 13:38:58 -0400 Received: by mail-wm1-x32c.google.com with SMTP id 5b1f17b1804b1-40859c464daso8981275e9.1 for ; Thu, 02 Nov 2023 10:38:55 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1698946735; x=1699551535; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:from:to:cc:subject:date:message-id :reply-to; bh=bw+NalypwIx1j4sKRcT1ebbMc0jvSR3eUfnw2LvsKB0=; b=a3HAL3CQ5tyXCntH1L+QJqHRV0lmnM40IvGQdD/zCmlMezn1gz7WEvhao/0/yrjgKa OWppC7480coI2FDSAjldbIQoBhFHycp5UZI4zZPDBAD5AAiaB2fnd1UIFPceoMUnaAXI X+mYVsZ6ZB9n4iD4hbzVV1oKoX92GCMUnhzdyJqI2JQYZm/1WoAKoVf0hhEb+NwKrRs2 B8jaBY7yV5IeUEX5EDwIyGtk/OdVwpRnfmWn0YarztKRFyOBFYCQ6tYFQFavAQUpqd0T uKarY1rB8CF9OE7BKCM8RGVRjfxabQaBFC8yxWB65XwiNIOurfJL+Lsg1OM886YcW1vd XgWA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1698946735; x=1699551535; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=bw+NalypwIx1j4sKRcT1ebbMc0jvSR3eUfnw2LvsKB0=; b=Eg2e5UrB4600BTtitQpm8AFKI+dl52l/O2w6VEXhL49XPBay/rvhx33Owg1Gudv0x6 3+EYzpRnfnFrc3Z/f/86JkFAZ8D4ZXEYj3/b5jbmJd73Msw/amfrWNm78f08WDNArOwE +UXK9RCgZEvv6hWcgEU1SqkSu98W3Fm5A9LfI3/MNr0GkMxO7uBpIZqAADJItfSIvg7Q 2FF8sy6oN5pHIAuDDZK+6/2OkPAr9GdFFcGLvuBPbEfpcXUg7jWWk0Gl7s4SkXNy6CFV qpoQu2EW0P3fIHkyTvENkoR9zm17U8Z85U83CJPPXXF89IJfgRLYF9lnPTAGZpSrkyl3 oAvA== X-Gm-Message-State: AOJu0YzULEf1yQ9cbNadCi8Rjv05vYW1kGIVxaoQkbKVXqem4j/Fvcl9 J4ZBMo6kZOAEN/nLHp2dIwDhjdJvRvHSm5zljIk= X-Received: by 2002:a5d:6d86:0:b0:32f:7f17:b049 with SMTP id l6-20020a5d6d86000000b0032f7f17b049mr12050011wrs.39.1698946734856; Thu, 02 Nov 2023 10:38:54 -0700 (PDT) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [2001:8b0:1d0::2]) by smtp.gmail.com with ESMTPSA id e16-20020adff350000000b003258934a4bcsm3046805wrp.42.2023.11.02.10.38.54 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 02 Nov 2023 10:38:54 -0700 (PDT) From: Peter Maydell To: qemu-devel@nongnu.org Subject: [PULL 32/33] hw/arm: xlnx-versal-virt: Add AMD/Xilinx TRNG device Date: Thu, 2 Nov 2023 17:38:34 +0000 Message-Id: <20231102173835.609985-33-peter.maydell@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231102173835.609985-1-peter.maydell@linaro.org> References: <20231102173835.609985-1-peter.maydell@linaro.org> MIME-Version: 1.0 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, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org From: Tong Ho Connect the support for Versal True Random Number Generator (TRNG) device. Warning: unlike the TRNG component in a real device from the Versal device familiy, the connected TRNG model is not of cryptographic grade and is not intended for use cases when cryptograpically strong TRNG is needed. Signed-off-by: Tong Ho Reviewed-by: Francisco Iglesias Reviewed-by: Peter Maydell Message-id: 20231031184611.3029156-3-tong.ho@amd.com Signed-off-by: Peter Maydell --- include/hw/arm/xlnx-versal.h | 5 +++++ hw/arm/xlnx-versal.c | 16 ++++++++++++++++ hw/arm/Kconfig | 1 + 3 files changed, 22 insertions(+) diff --git a/include/hw/arm/xlnx-versal.h b/include/hw/arm/xlnx-versal.h index b710d71fb08..b24fa64557f 100644 --- a/include/hw/arm/xlnx-versal.h +++ b/include/hw/arm/xlnx-versal.h @@ -30,6 +30,7 @@ #include "hw/dma/xlnx_csu_dma.h" #include "hw/misc/xlnx-versal-crl.h" #include "hw/misc/xlnx-versal-pmc-iou-slcr.h" +#include "hw/misc/xlnx-versal-trng.h" #include "hw/net/xlnx-versal-canfd.h" #include "hw/misc/xlnx-versal-cfu.h" #include "hw/misc/xlnx-versal-cframe-reg.h" @@ -115,6 +116,7 @@ struct Versal { } iou; XlnxZynqMPRTC rtc; + XlnxVersalTRng trng; XlnxBBRam bbram; XlnxEFuse efuse; XlnxVersalEFuseCtrl efuse_ctrl; @@ -159,6 +161,7 @@ struct Versal { #define VERSAL_OSPI_IRQ 124 #define VERSAL_SD0_IRQ_0 126 #define VERSAL_EFUSE_IRQ 139 +#define VERSAL_TRNG_IRQ 141 #define VERSAL_RTC_ALARM_IRQ 142 #define VERSAL_RTC_SECONDS_IRQ 143 @@ -328,4 +331,6 @@ struct Versal { #define MM_PMC_CRP_SIZE 0x10000 #define MM_PMC_RTC 0xf12a0000 #define MM_PMC_RTC_SIZE 0x10000 +#define MM_PMC_TRNG 0xf1230000 +#define MM_PMC_TRNG_SIZE 0x10000 #endif diff --git a/hw/arm/xlnx-versal.c b/hw/arm/xlnx-versal.c index fa556d8764b..4f74a64a0d7 100644 --- a/hw/arm/xlnx-versal.c +++ b/hw/arm/xlnx-versal.c @@ -373,6 +373,21 @@ static void versal_create_rtc(Versal *s, qemu_irq *pic) qdev_get_gpio_in(DEVICE(&s->pmc.apb_irq_orgate), 0)); } +static void versal_create_trng(Versal *s, qemu_irq *pic) +{ + SysBusDevice *sbd; + MemoryRegion *mr; + + object_initialize_child(OBJECT(s), "trng", &s->pmc.trng, + TYPE_XLNX_VERSAL_TRNG); + sbd = SYS_BUS_DEVICE(&s->pmc.trng); + sysbus_realize(sbd, &error_fatal); + + mr = sysbus_mmio_get_region(sbd, 0); + memory_region_add_subregion(&s->mr_ps, MM_PMC_TRNG, mr); + sysbus_connect_irq(sbd, 0, pic[VERSAL_TRNG_IRQ]); +} + static void versal_create_xrams(Versal *s, qemu_irq *pic) { int nr_xrams = ARRAY_SIZE(s->lpd.xram.ctrl); @@ -909,6 +924,7 @@ static void versal_realize(DeviceState *dev, Error **errp) versal_create_sds(s, pic); versal_create_pmc_apb_irq_orgate(s, pic); versal_create_rtc(s, pic); + versal_create_trng(s, pic); versal_create_xrams(s, pic); versal_create_bbram(s, pic); versal_create_efuse(s, pic); diff --git a/hw/arm/Kconfig b/hw/arm/Kconfig index 841f3131ea5..e35007ed413 100644 --- a/hw/arm/Kconfig +++ b/hw/arm/Kconfig @@ -482,6 +482,7 @@ config XLNX_VERSAL select XLNX_BBRAM select XLNX_EFUSE_VERSAL select XLNX_USB_SUBSYS + select XLNX_VERSAL_TRNG config NPCM7XX bool From patchwork Thu Nov 2 17:38:35 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 740457 Delivered-To: patch@linaro.org Received: by 2002:a5d:538f:0:b0:32d:baff:b0ca with SMTP id d15csp962071wrv; Thu, 2 Nov 2023 10:41:13 -0700 (PDT) X-Google-Smtp-Source: AGHT+IF+G4CpJdi6LQJnvSq22YdZ2akmfnj80GiR0qNXw6VN4+NuWRPTcPjzSKeMuS/buJnp0J/7 X-Received: by 2002:a05:6808:14cb:b0:3a7:7bd3:7ab7 with SMTP id f11-20020a05680814cb00b003a77bd37ab7mr25414432oiw.51.1698946873062; Thu, 02 Nov 2023 10:41:13 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1698946873; cv=none; d=google.com; s=arc-20160816; b=K6YwkgJtfKYb9gWJKA8CI5URgMzHThemP0Ejc+bjozmzK4sVMP3JSC5YB36dtxdE7L VFMFV/sFkI35BT3kGe2DitzMht4YOF/sPYmpQayitxIjKCPZ21ua4abkLrN2SxZCpZSC wISsLC4hhMNDy5IYY0pUNpmCCVUPVsUhxZuSSZvhMSXT8jbWOOvdAAQSTGboNxo/J34X Zbm1qhpQKhITBWNIJe5OAMwVQMZo7nPQPehneu4OODOuHvf+ojSTxuiwfkC4q0QvSDco Cf9GXg9dgUMYLSDoyCvn026XYbp6SMq4Gu9ErI6n+1rezgupcsQCCHjJMhiTHAFxfLAp 5iMg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:to:from :dkim-signature; bh=2hdsfgROoLyMm+E88N5RaU7KkOYCd8OTBUwoctxhH9c=; fh=PnYt+qEB9tAfMKoqBm2xjKOFpYyFFGPudh5cVIoieJM=; b=vAAyWsZ378p4wAtmP5dA9C/9+Wa4X+29QLUbdJmK2gZoFtpdwkXMxOkUeIdF2LM5Na kCtf/9JENukEWGrf1CkavwuQrlYDX2Z6S5CI0gocIpC2a3Vi5Glv2qnFjgPBMqFp9sHs KZswIoVf221N68BCzSU7zdRtFjfnN6c78aOxj8WBgg3t9I2WRkXwvVdyHbth0r4ngT2T EITv/lCTWX0PaudsTdq+rXpYWt3cssItF4pzjOyelBLBWzW1y6Ft4m+5sV+x3ftfsNul bx9IUVQd3lh6H0XWRcJRF012VYekdnOK+BUUMs0oaTDGs2WjtdT24VLF3bHvNju8I+X1 PzgQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=nLGImcAZ; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id u4-20020a05620a0c4400b00775762f28c2si324854qki.81.2023.11.02.10.41.12 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Thu, 02 Nov 2023 10:41:13 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=nLGImcAZ; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qybfS-0003vb-2o; Thu, 02 Nov 2023 13:39:42 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qybel-0003I8-Nx for qemu-devel@nongnu.org; Thu, 02 Nov 2023 13:39:00 -0400 Received: from mail-wr1-x42c.google.com ([2a00:1450:4864:20::42c]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qybej-00032D-5X for qemu-devel@nongnu.org; Thu, 02 Nov 2023 13:38:59 -0400 Received: by mail-wr1-x42c.google.com with SMTP id ffacd0b85a97d-32ded3eb835so812291f8f.0 for ; Thu, 02 Nov 2023 10:38:56 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1698946735; x=1699551535; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:from:to:cc:subject:date:message-id :reply-to; bh=2hdsfgROoLyMm+E88N5RaU7KkOYCd8OTBUwoctxhH9c=; b=nLGImcAZ9Ich3oavwV7AVtDxHSkJvUhlPBsiVYAOiGl3+yjtQDdgbi/IEK9xAJWiti qoQB3s7b2bFx9F69pVnqZwg+w7Q3pqlZtzYqKQuPq1IT+SWh2jSUwI2DMs9jcy2jwWm7 S0cEWkyJalREISbJ9hr0AYT9PkqQeG4Tw2t9uTQUTH+oDg/HC+c6UM03VOzjky2jVuL7 VB/w8en5N5FyNgoAVLiZ+117evIqIWoW2tmxaOBr5xJPPzKhC0IrjjZnXPyQs4Yw3ZdO /p2Huic2YcnQ8jIwpmREl9lZhzDFm0BQHOWnAywgeubfwdAna8mRjWtffpJYWhJK+HU9 Z2dA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1698946735; x=1699551535; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=2hdsfgROoLyMm+E88N5RaU7KkOYCd8OTBUwoctxhH9c=; b=w3NVB705ar5EYHWNtLNs2vURMfzOCKHmWOpQ5h9GpujagwsphSaVU6z2C3iterIde6 cVy0S2ti0KXqpKb8giLbNMsU/Nlf97ZKYkqFxECIsLPof4uSpGXpvJOXWl4JrT4Ie04L sUSPaVRemKyMz+/Er/QNwC8+RLCRk8vcxUskllFfRkOMUUpA75sFhNf2edHzFhBnq7aK 3iNMQjm5F8NrPh4zlQDdnI//7YRC5nf4zw+c1rDCefn/qL2tVRw2lt/AprE4Frqw2oma eJq5db3RH7s6Y6j21+BHYz0Iuk3RXORnmr8B+f+GOprK+bJP6vv4rZP+wUO4k89WfOj0 QfPA== X-Gm-Message-State: AOJu0Yxl9MbGEPa0UJo7fgE0TCePcE5rQwDJLKWq14HhKbcZEBI/YEdR rCDvbPR2DSZyS4pMMSIzVoaD3+M3d2SxfJ7ji24= X-Received: by 2002:adf:ecc9:0:b0:31f:ffd1:6cf4 with SMTP id s9-20020adfecc9000000b0031fffd16cf4mr14998668wro.12.1698946735380; Thu, 02 Nov 2023 10:38:55 -0700 (PDT) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [2001:8b0:1d0::2]) by smtp.gmail.com with ESMTPSA id e16-20020adff350000000b003258934a4bcsm3046805wrp.42.2023.11.02.10.38.54 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 02 Nov 2023 10:38:55 -0700 (PDT) From: Peter Maydell To: qemu-devel@nongnu.org Subject: [PULL 33/33] tests/qtest: Introduce tests for AMD/Xilinx Versal TRNG device Date: Thu, 2 Nov 2023 17:38:35 +0000 Message-Id: <20231102173835.609985-34-peter.maydell@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231102173835.609985-1-peter.maydell@linaro.org> References: <20231102173835.609985-1-peter.maydell@linaro.org> MIME-Version: 1.0 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, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org From: Tong Ho Signed-off-by: Tong Ho Message-id: 20231031184611.3029156-4-tong.ho@amd.com Reviewed-by: Peter Maydell Signed-off-by: Peter Maydell --- tests/qtest/xlnx-versal-trng-test.c | 485 ++++++++++++++++++++++++++++ tests/qtest/meson.build | 2 +- 2 files changed, 486 insertions(+), 1 deletion(-) create mode 100644 tests/qtest/xlnx-versal-trng-test.c diff --git a/tests/qtest/xlnx-versal-trng-test.c b/tests/qtest/xlnx-versal-trng-test.c new file mode 100644 index 00000000000..cef4e575bba --- /dev/null +++ b/tests/qtest/xlnx-versal-trng-test.c @@ -0,0 +1,485 @@ +/* + * QTests for the Xilinx Versal True Random Number Generator device + * + * Copyright (c) 2023 Advanced Micro Devices, Inc. + * + * SPDX-License-Identifier: GPL-2.0-or-later + */ + +#include "qemu/osdep.h" +#include "libqtest-single.h" + +/* Base Address */ +#define TRNG_BASEADDR (0xf1230000) + +/* TRNG_INT_CTRL */ +#define R_TRNG_INT_CTRL (0x0000) +#define TRNG_INT_CTRL_CERTF_RST_MASK (1 << 5) +#define TRNG_INT_CTRL_DTF_RST_MASK (1 << 4) +#define TRNG_INT_CTRL_DONE_RST_MASK (1 << 3) +#define TRNG_INT_CTRL_CERTF_EN_MASK (1 << 2) +#define TRNG_INT_CTRL_DTF_EN_MASK (1 << 1) +#define TRNG_INT_CTRL_DONE_EN_MASK (1) + +/* TRNG_STATUS */ +#define R_TRNG_STATUS (0x0004) +#define TRNG_STATUS_QCNT_SHIFT (9) +#define TRNG_STATUS_QCNT_MASK (7 << TRNG_STATUS_QCNT_SHIFT) +#define TRNG_STATUS_CERTF_MASK (1 << 3) +#define TRNG_STATUS_DTF_MASK (1 << 1) +#define TRNG_STATUS_DONE_MASK (1) + +/* TRNG_CTRL */ +#define R_TRNG_CTRL (0x0008) +#define TRNG_CTRL_PERSODISABLE_MASK (1 << 10) +#define TRNG_CTRL_SINGLEGENMODE_MASK (1 << 9) +#define TRNG_CTRL_PRNGMODE_MASK (1 << 7) +#define TRNG_CTRL_TSTMODE_MASK (1 << 6) +#define TRNG_CTRL_PRNGSTART_MASK (1 << 5) +#define TRNG_CTRL_PRNGXS_MASK (1 << 3) +#define TRNG_CTRL_TRSSEN_MASK (1 << 2) +#define TRNG_CTRL_QERTUEN_MASK (1 << 1) +#define TRNG_CTRL_PRNGSRST_MASK (1) + +/* TRNG_EXT_SEED_0 ... _11 */ +#define R_TRNG_EXT_SEED_0 (0x0040) +#define R_TRNG_EXT_SEED_11 (R_TRNG_EXT_SEED_0 + 4 * 11) + +/* TRNG_PER_STRNG_0 ... 11 */ +#define R_TRNG_PER_STRNG_0 (0x0080) +#define R_TRNG_PER_STRNG_11 (R_TRNG_PER_STRNG_0 + 4 * 11) + +/* TRNG_CORE_OUTPUT */ +#define R_TRNG_CORE_OUTPUT (0x00c0) + +/* TRNG_RESET */ +#define R_TRNG_RESET (0x00d0) +#define TRNG_RESET_VAL_MASK (1) + +/* TRNG_OSC_EN */ +#define R_TRNG_OSC_EN (0x00d4) +#define TRNG_OSC_EN_VAL_MASK (1) + +/* TRNG_TRNG_ISR, _IMR, _IER, _IDR */ +#define R_TRNG_ISR (0x00e0) +#define R_TRNG_IMR (0x00e4) +#define R_TRNG_IER (0x00e8) +#define R_TRNG_IDR (0x00ec) +#define TRNG_IRQ_SLVERR_MASK (1 << 1) +#define TRNG_IRQ_CORE_INT_MASK (1) + +/* + * End test with a formatted error message, by embedding the message + * in a GError. + */ +#define TRNG_FAILED(FMT, ...) \ + do { \ + g_autoptr(GError) err = g_error_new( \ + g_quark_from_static_string(trng_qname), 0, \ + FMT, ## __VA_ARGS__); \ + g_assert_no_error(err); \ + } while (0) + +static const gchar trng_qname[] = "xlnx-versal-trng-test"; + +static const uint32_t prng_seed[12] = { + 0x01234567, 0x12345678, 0x23456789, 0x3456789a, 0x456789ab, 0x56789abc, + 0x76543210, 0x87654321, 0x98765432, 0xa9876543, 0xba987654, 0xfedcba98, +}; + +static const uint32_t pers_str[12] = { + 0x76543210, 0x87654321, 0x98765432, 0xa9876543, 0xba987654, 0xfedcba98, + 0x01234567, 0x12345678, 0x23456789, 0x3456789a, 0x456789ab, 0x56789abc, +}; + +static void trng_test_start(void) +{ + qtest_start("-machine xlnx-versal-virt"); +} + +static void trng_test_stop(void) +{ + qtest_end(); +} + +static void trng_test_set_uint_prop(const char *name, uint64_t value) +{ + const char *path = "/machine/xlnx-versal/trng"; + QDict *response; + + response = qmp("{ 'execute': 'qom-set'," + " 'arguments': {" + " 'path': %s," + " 'property': %s," + " 'value': %llu" + "} }", path, + name, (unsigned long long)value); + g_assert(qdict_haskey(response, "return")); + qobject_unref(response); +} + +static void trng_write(unsigned ra, uint32_t val) +{ + writel(TRNG_BASEADDR + ra, val); +} + +static uint32_t trng_read(unsigned ra) +{ + return readl(TRNG_BASEADDR + ra); +} + +static void trng_bit_set(unsigned ra, uint32_t bits) +{ + trng_write(ra, (trng_read(ra) | bits)); +} + +static void trng_bit_clr(unsigned ra, uint32_t bits) +{ + trng_write(ra, (trng_read(ra) & ~bits)); +} + +static void trng_ctrl_set(uint32_t bits) +{ + trng_bit_set(R_TRNG_CTRL, bits); +} + +static void trng_ctrl_clr(uint32_t bits) +{ + trng_bit_clr(R_TRNG_CTRL, bits); +} + +static uint32_t trng_status(void) +{ + return trng_read(R_TRNG_STATUS); +} + +static unsigned trng_qcnt(void) +{ + uint32_t sta = trng_status(); + + return (sta & TRNG_STATUS_QCNT_MASK) >> TRNG_STATUS_QCNT_SHIFT; +} + +static const char *trng_info(void) +{ + uint32_t sta = trng_status(); + uint32_t ctl = trng_read(R_TRNG_CTRL); + + static char info[64]; + + snprintf(info, sizeof(info), "; status=0x%x, ctrl=0x%x", sta, ctl); + return info; +} + +static void trng_check_status(uint32_t status_mask, const char *act) +{ + uint32_t clear_mask = 0; + uint32_t status; + + /* + * Only selected bits are events in R_TRNG_STATUS, and + * clear them needs to go through R_INT_CTRL. + */ + if (status_mask & TRNG_STATUS_CERTF_MASK) { + clear_mask |= TRNG_INT_CTRL_CERTF_RST_MASK; + } + if (status_mask & TRNG_STATUS_DTF_MASK) { + clear_mask |= TRNG_INT_CTRL_DTF_RST_MASK; + } + if (status_mask & TRNG_STATUS_DONE_MASK) { + clear_mask |= TRNG_INT_CTRL_DONE_RST_MASK; + } + + status = trng_status(); + if ((status & status_mask) != status_mask) { + TRNG_FAILED("%s: Status bitmask 0x%x failed to be 1%s", + act, status_mask, trng_info()); + } + + /* Remove event */ + trng_bit_set(R_TRNG_INT_CTRL, clear_mask); + + if (!!(trng_read(R_TRNG_STATUS) & status_mask)) { + TRNG_FAILED("%s: Event 0x%0x stuck at 1 after clear: %s", + act, status_mask, trng_info()); + } +} + +static void trng_check_done_status(const char *act) +{ + trng_check_status(TRNG_STATUS_DONE_MASK, act); +} + +static void trng_check_dtf_status(void) +{ + trng_check_status(TRNG_STATUS_DTF_MASK, "DTF injection"); +} + +static void trng_check_certf_status(void) +{ + trng_check_status(TRNG_STATUS_CERTF_MASK, "CERTF injection"); +} + +static void trng_reset(void) +{ + trng_write(R_TRNG_RESET, TRNG_RESET_VAL_MASK); + trng_write(R_TRNG_RESET, 0); +} + +static void trng_load(unsigned r0, const uint32_t *b384) +{ + static const uint32_t zero[12] = { 0 }; + unsigned k; + + if (!b384) { + b384 = zero; + } + + for (k = 0; k < 12; k++) { + trng_write(r0 + 4 * k, b384[k]); + } +} + +static void trng_reseed(const uint32_t *seed) +{ + const char *act; + uint32_t ctl; + + ctl = TRNG_CTRL_PRNGSTART_MASK | + TRNG_CTRL_PRNGXS_MASK | + TRNG_CTRL_TRSSEN_MASK; + + trng_ctrl_clr(ctl | TRNG_CTRL_PRNGMODE_MASK); + + if (seed) { + trng_load(R_TRNG_EXT_SEED_0, seed); + act = "Reseed PRNG"; + ctl &= ~TRNG_CTRL_TRSSEN_MASK; + } else { + trng_write(R_TRNG_OSC_EN, TRNG_OSC_EN_VAL_MASK); + act = "Reseed TRNG"; + ctl &= ~TRNG_CTRL_PRNGXS_MASK; + } + + trng_ctrl_set(ctl); + trng_check_done_status(act); + trng_ctrl_clr(TRNG_CTRL_PRNGSTART_MASK); +} + +static void trng_generate(bool auto_enb) +{ + uint32_t ctl; + + ctl = TRNG_CTRL_PRNGSTART_MASK | TRNG_CTRL_SINGLEGENMODE_MASK; + trng_ctrl_clr(ctl); + + if (auto_enb) { + ctl &= ~TRNG_CTRL_SINGLEGENMODE_MASK; + } + + trng_ctrl_set(ctl | TRNG_CTRL_PRNGMODE_MASK); + + trng_check_done_status("Generate"); + g_assert(trng_qcnt() != 7); +} + +static size_t trng_collect(uint32_t *rnd, size_t cnt) +{ + size_t i; + + for (i = 0; i < cnt; i++) { + if (trng_qcnt() == 0) { + return i; + } + + rnd[i] = trng_read(R_TRNG_CORE_OUTPUT); + } + + return i; +} + +static void trng_test_autogen(void) +{ + const size_t cnt = 512 / 32; + uint32_t rng[cnt], prng[cnt]; + size_t n; + + trng_reset(); + + /* PRNG run #1 */ + trng_reseed(prng_seed); + trng_generate(true); + + n = trng_collect(prng, cnt); + if (n != cnt) { + TRNG_FAILED("PRNG_1 Auto-gen test failed: expected = %u, got = %u", + (unsigned)cnt, (unsigned)n); + } + + /* TRNG, should not match PRNG */ + trng_reseed(NULL); + trng_generate(true); + + n = trng_collect(rng, cnt); + if (n != cnt) { + TRNG_FAILED("TRNG Auto-gen test failed: expected = %u, got = %u", + (unsigned)cnt, (unsigned)n); + } + + /* PRNG #2: should matches run #1 */ + trng_reseed(prng_seed); + trng_generate(true); + + n = trng_collect(rng, cnt); + if (n != cnt) { + TRNG_FAILED("PRNG_2 Auto-gen test failed: expected = %u, got = %u", + (unsigned)cnt, (unsigned)n); + } + + if (memcmp(rng, prng, sizeof(rng))) { + TRNG_FAILED("PRNG_2 Auto-gen test failed: does not match PRNG_1"); + } +} + +static void trng_test_oneshot(void) +{ + const size_t cnt = 512 / 32; + uint32_t rng[cnt]; + size_t n; + + trng_reset(); + + /* PRNG run #1 */ + trng_reseed(prng_seed); + trng_generate(false); + + n = trng_collect(rng, cnt); + if (n == cnt) { + TRNG_FAILED("PRNG_1 One-shot gen test failed"); + } + + /* TRNG, should not match PRNG */ + trng_reseed(NULL); + trng_generate(false); + + n = trng_collect(rng, cnt); + if (n == cnt) { + TRNG_FAILED("TRNG One-shot test failed"); + } +} + +static void trng_test_per_str(void) +{ + const size_t cnt = 512 / 32; + uint32_t rng[cnt], prng[cnt]; + size_t n; + + trng_reset(); + + /* #1: disabled */ + trng_ctrl_set(TRNG_CTRL_PERSODISABLE_MASK); + trng_reseed(prng_seed); + trng_ctrl_clr(TRNG_CTRL_PERSODISABLE_MASK); + + trng_generate(true); + n = trng_collect(prng, cnt); + g_assert_cmpuint(n, ==, cnt); + + /* #2: zero string should match personalization disabled */ + trng_load(R_TRNG_PER_STRNG_0, NULL); + trng_reseed(prng_seed); + + trng_generate(true); + n = trng_collect(rng, cnt); + g_assert_cmpuint(n, ==, cnt); + + if (memcmp(rng, prng, sizeof(rng))) { + TRNG_FAILED("Failed: PER_DISABLE != PER_STRNG_ALL_ZERO"); + } + + /* #3: non-zero string should not match personalization disabled */ + trng_load(R_TRNG_PER_STRNG_0, pers_str); + trng_reseed(prng_seed); + + trng_generate(true); + n = trng_collect(rng, cnt); + g_assert_cmpuint(n, ==, cnt); + + if (!memcmp(rng, prng, sizeof(rng))) { + TRNG_FAILED("Failed: PER_DISABLE == PER_STRNG_NON_ZERO"); + } +} + +static void trng_test_forced_prng(void) +{ + const char *prop = "forced-prng"; + const uint64_t seed = 0xdeadbeefbad1bad0ULL; + + const size_t cnt = 512 / 32; + uint32_t rng[cnt], prng[cnt]; + size_t n; + + trng_reset(); + trng_test_set_uint_prop(prop, seed); + + /* TRNG run #1 */ + trng_reset(); + trng_reseed(NULL); + trng_generate(true); + + n = trng_collect(prng, cnt); + g_assert_cmpuint(n, ==, cnt); + + /* TRNG run #2 should match run #1 */ + trng_reset(); + trng_reseed(NULL); + trng_generate(true); + + n = trng_collect(rng, cnt); + g_assert_cmpuint(n, ==, cnt); + + if (memcmp(rng, prng, sizeof(rng))) { + TRNG_FAILED("Forced-prng test failed: results do not match"); + } +} + +static void trng_test_fault_events(void) +{ + const char *prop = "fips-fault-events"; + + trng_reset(); + + /* Fault events only when TRSS is enabled */ + trng_write(R_TRNG_OSC_EN, TRNG_OSC_EN_VAL_MASK); + trng_ctrl_set(TRNG_CTRL_TRSSEN_MASK); + + trng_test_set_uint_prop(prop, TRNG_STATUS_CERTF_MASK); + trng_check_certf_status(); + + trng_test_set_uint_prop(prop, TRNG_STATUS_DTF_MASK); + trng_check_dtf_status(); + + trng_reset(); +} + +int main(int argc, char **argv) +{ + int rc; + + g_test_init(&argc, &argv, NULL); + + #define TRNG_TEST_ADD(n) \ + qtest_add_func("/hw/misc/xlnx-versal-trng/" #n, trng_test_ ## n); + TRNG_TEST_ADD(autogen); + TRNG_TEST_ADD(oneshot); + TRNG_TEST_ADD(per_str); + TRNG_TEST_ADD(forced_prng); + TRNG_TEST_ADD(fault_events); + #undef TRNG_TEST_ADD + + trng_test_start(); + rc = g_test_run(); + trng_test_stop(); + + return rc; +} diff --git a/tests/qtest/meson.build b/tests/qtest/meson.build index d6022ebd647..c9945e69b19 100644 --- a/tests/qtest/meson.build +++ b/tests/qtest/meson.build @@ -216,7 +216,7 @@ qtests_aarch64 = \ (config_all.has_key('CONFIG_TCG') and config_all_devices.has_key('CONFIG_TPM_TIS_SYSBUS') ? \ ['tpm-tis-device-test', 'tpm-tis-device-swtpm-test'] : []) + \ (config_all_devices.has_key('CONFIG_XLNX_ZYNQMP_ARM') ? ['xlnx-can-test', 'fuzz-xlnx-dp-test'] : []) + \ - (config_all_devices.has_key('CONFIG_XLNX_VERSAL') ? ['xlnx-canfd-test'] : []) + \ + (config_all_devices.has_key('CONFIG_XLNX_VERSAL') ? ['xlnx-canfd-test', 'xlnx-versal-trng-test'] : []) + \ (config_all_devices.has_key('CONFIG_RASPI') ? ['bcm2835-dma-test'] : []) + \ (config_all.has_key('CONFIG_TCG') and \ config_all_devices.has_key('CONFIG_TPM_TIS_I2C') ? ['tpm-tis-i2c-test'] : []) + \