From patchwork Mon Sep 26 13:38:56 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Alex_Benn=C3=A9e?= X-Patchwork-Id: 609325 Delivered-To: patch@linaro.org Received: by 2002:a17:522:c983:b0:460:3032:e3c4 with SMTP id kr3csp1887497pvb; Mon, 26 Sep 2022 07:20:40 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6zLPomcYVG/BLaDoodzOJL+L5m/G5txxSro2LzofLYv9pqaUuIn9kbxJ2msLrHeJ1MRH3H X-Received: by 2002:a05:620a:4c:b0:6ce:b5f:1320 with SMTP id t12-20020a05620a004c00b006ce0b5f1320mr14507040qkt.569.1664202040093; Mon, 26 Sep 2022 07:20:40 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1664202040; cv=none; d=google.com; s=arc-20160816; b=J3D01uDkTKzBV9OtVZSCF/aeND03XOwER2JDiqkX/NNalCsW7oLTDo0LJJPqWUeH0z O5mro5FRkgVlKAQ6ZwFTHQAsaLVtPeF7/sghJCtlwfpWyMNOUcjQ5kvly8eN7LRpPgkd O/x4T+A3GLNrPXrAwoBGRDPG8Nm1HZPOsaPvcgJHb8H8wvrNB1pbmLJIL3QymCzELaPv dh9IQEO9lapHPn521+nv9Le0pJzQRgt+PgeF0pVMkMWb4GEIMFCMkXt4fZ9OACvriZAf JEW+hH7PMQVPD/ux6B58ttsOGYQGwONV400P/+p7CcqX1U9yr7Zrog7fTH7w/l8PwYlm M8Lw== 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:cc:to :from:dkim-signature; bh=8kZr1rxByNkxMPVyKr7Y5lFL0hfWuti5PLDqMUepXx8=; b=KHqINXky0ZxOl1YgoomozNkeXLqzXZX9rOX1E/9TPBRKL2g4gzNE64sa2YNHJy2tmV VQadIQxQ9xi6VYFvKhnIWpQCmb6LBeCAPy1RgJMoUkxCgxkecuHcLzZiBMVes+vv34PE GjQoreSfoBsm6PAm7+MBQBAE3GyyIMMYbLUT5bN9GsRrixI0citGnsUDBOKOGxW26pOQ z3977eQe/iQb3BHlnC7+tuwLyt5Ac4vv+m4BZRViHZD/Zu5UwcdXH+XxLMg0on4gwchw gybMXiXKjFacmQcKX9eURrT8vzqLRbMPAmR4ftgUK5eUl2dWHLtF4Md+Cfr0TVmfVqQK yogw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=ndwy5+eZ; 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 gw10-20020a0562140f0a00b004ad6fe3b784si9176749qvb.69.2022.09.26.07.20.39 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 26 Sep 2022 07:20: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=ndwy5+eZ; 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]:48412 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ocoyN-00057h-3T for patch@linaro.org; Mon, 26 Sep 2022 10:20:39 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:48182) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ocoKH-00021V-Ht for qemu-devel@nongnu.org; Mon, 26 Sep 2022 09:39:14 -0400 Received: from mail-wm1-x32f.google.com ([2a00:1450:4864:20::32f]:50833) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1ocoKD-0005eR-Kx for qemu-devel@nongnu.org; Mon, 26 Sep 2022 09:39:13 -0400 Received: by mail-wm1-x32f.google.com with SMTP id ay36so4546363wmb.0 for ; Mon, 26 Sep 2022 06:39:09 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date; bh=8kZr1rxByNkxMPVyKr7Y5lFL0hfWuti5PLDqMUepXx8=; b=ndwy5+eZkVYESsES7LBxBD3/B8G371rAOcNuqnAtAQ9nxRsUWFxCrTizlD0qkJKV3Q a51WtnaAehNkkWxwddzKW06t24i0AFDJSspiXJn3Y9pH1KB/OtLzdntSC+QKPeccGRAo vKpuh5zotD58D2Qr0t0AS1Nh5iXGql8mBF2/7ZjPZf2+7z/i4f/WcmXlqVkoQFqkZt9j AprIBjCtmAc/LxlXFD4tX58lYFU7zZxzKgFpNWdL6ehav4fcfCzgYCF8KdIOPeKO4K1q HFZvtTb0i7+tEkLianYZuy8x0+x9A/FMAdZ/Vi9eqLti5aToR6huOu0shV0jXGm787TH PCXw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date; bh=8kZr1rxByNkxMPVyKr7Y5lFL0hfWuti5PLDqMUepXx8=; b=vajlz7lOWUyDiEtOJ+a4y9YG//Hx+njwJa2fc3/29VJ7o3tW9XqGpXgkp3AR123G5R obA/+eyj71YY69dtvdfUGMthcab8bHyucsqwB/KGOvSAxn8K7ouPKsbLwfQypEgJTDnz yiMQRHC3azYgsagiD8Yz4XgsMsfPicJF/8v9PGdcNibuE50pNubgv/0xVNmP4PzedtzZ pLkyn56d2WvuqIgUuoFmHXZnHgvshhkrUBNiWLoDi5esevwG2YBA7OfFqTyytkNw7HYx aEVh98udeZcn3mmOZm9YhDf/SCtq6GehhYrIYXGZpRfDQPSZ8k5GkzIma4eqezf7VLct oSMA== X-Gm-Message-State: ACrzQf00E/QQFVkDC5pBLO09gPezNKjbaRrE40WYQb/tr0H7HnljxpY8 yX3KpIKd6HBiGtdpvVsI7N0egA== X-Received: by 2002:a05:600c:a07:b0:3ab:945:77c4 with SMTP id z7-20020a05600c0a0700b003ab094577c4mr22167987wmp.97.1664199548086; Mon, 26 Sep 2022 06:39:08 -0700 (PDT) Received: from zen.linaroharston ([185.81.254.11]) by smtp.gmail.com with ESMTPSA id i6-20020a05600c354600b003b47b80cec3sm11918658wmq.42.2022.09.26.06.39.05 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 26 Sep 2022 06:39:05 -0700 (PDT) Received: from zen.lan (localhost [127.0.0.1]) by zen.linaroharston (Postfix) with ESMTP id F34651FFBB; Mon, 26 Sep 2022 14:39:04 +0100 (BST) From: =?utf-8?q?Alex_Benn=C3=A9e?= To: qemu-devel@nongnu.org Cc: f4bug@amsat.org, mads@ynddal.dk, qemu-arm@nongnu.org, =?utf-8?q?Alex_Ben?= =?utf-8?q?n=C3=A9e?= , Alexander Graf , Peter Maydell Subject: [PATCH v2 03/11] target/arm: ensure HVF traps set appropriate MemTxAttrs Date: Mon, 26 Sep 2022 14:38:56 +0100 Message-Id: <20220926133904.3297263-4-alex.bennee@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220926133904.3297263-1-alex.bennee@linaro.org> References: <20220926133904.3297263-1-alex.bennee@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::32f; envelope-from=alex.bennee@linaro.org; helo=mail-wm1-x32f.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=unavailable autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" As most HVF devices are done purely in software we need to make sure we properly encode the source CPU in MemTxAttrs. This will allow the device emulations to use those attributes rather than relying on current_cpu (although current_cpu will still be correct in this case). Signed-off-by: Alex Bennée Cc: Mads Ynddal Cc: Alexander Graf Acked-by: Alexander Graf --- target/arm/hvf/hvf.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/target/arm/hvf/hvf.c b/target/arm/hvf/hvf.c index 060aa0ccf4..13b7971560 100644 --- a/target/arm/hvf/hvf.c +++ b/target/arm/hvf/hvf.c @@ -1233,11 +1233,11 @@ int hvf_vcpu_exec(CPUState *cpu) val = hvf_get_reg(cpu, srt); address_space_write(&address_space_memory, hvf_exit->exception.physical_address, - MEMTXATTRS_UNSPECIFIED, &val, len); + MEMTXATTRS_CPU(cpu->cpu_index), &val, len); } else { address_space_read(&address_space_memory, hvf_exit->exception.physical_address, - MEMTXATTRS_UNSPECIFIED, &val, len); + MEMTXATTRS_CPU(cpu->cpu_index), &val, len); hvf_set_reg(cpu, srt, val); }