Received: by 2002:a19:c345:0:0:0:0:0 with SMTP id t66csp667420lff; Wed, 4 Dec 2019 05:57:45 -0800 (PST) X-Google-Smtp-Source: APXvYqxsTZjf41a41tu6+uYY8BImhbWc1lcgfRgeGtZpgoa416Zy/RJRyjyrbkDurOnOhAexJI5+ X-Received: by 2002:a37:4acc:: with SMTP id x195mr2980207qka.52.1575467865015; Wed, 04 Dec 2019 05:57:45 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1575467865; cv=none; d=google.com; s=arc-20160816; b=x3rtQRodgiBipx47BtPbNBPyDLmuDJIZPCz+48Kt/gN2FeUjXYxbUxd1Bxs7oD62YD nIj6GQJV6RvbV2lQwb5+vH1fsAakfbNyBWeihBjBgmtcvdkK8s7nGJ1diXnfdj7IrmlC XJHqZ6P1cCDVn28b6KpHr2txVZT8GB6TtnA0BnxJa762Yr/+wvlqK4cIbFHb3UQxB9nv V16ntKwJVFGaT7GUqprDW2Grh1J4ztn5gd6x9yB0nM7uk+mB6Q4hNMufYnvznpNjJASE qVgRLVbUmtiqmycQdBCKQ5cgVfAveAH8TzWOp85siAXdC0L/MDa2ty5vHPLVo2eDlpn8 92yw== 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:references:in-reply-to :message-id:date:subject:cc:to:from:ironport-sdr:dkim-signature; bh=ZJTN+ohaJEyJa5Mz38YWX2orkNnDr5ayiRkSEay2Bdo=; b=NHnUI2SrHOM0+1jpM0SY0wdEImVVY5ATn9kfSgKlJwvQ9sg0+/prJVeu/rv5ibcLVh 18ejJW9ddR2nQ7HmbAUuoDNCw2qiteq5upRzoDQKaENZkHJqc4VQbRDGzw9+VPeU+87v w+0+zhtUijgOfvrQN/vlZ7uigl3Sqrgr8KIrCz63e4yDQH+HzcKiDzkWwpNy/a9jbHsx C07+aDDyTW//uIgwDyDxLMgeA3uYMSp+Ov4Sf5BZXHVPAXea7hMs95WDq3qjBzsuEZzF OTXyMgqQmwjesWIlJ5Mjdvtct8qEL5g4IE7fQRj+++3ckeNcYoZK+PAP7HJkdytIg3Rg 7DvQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@amazon.de header.s=amazon201209 header.b=Jb+yjW7W; spf=pass (google.com: domain of qemu-devel-bounces+alex.bennee=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+alex.bennee=linaro.org@nongnu.org"; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=amazon.de Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id m25si4625751qka.320.2019.12.04.05.57.44 for (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Wed, 04 Dec 2019 05:57:45 -0800 (PST) Received-SPF: pass (google.com: domain of qemu-devel-bounces+alex.bennee=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=@amazon.de header.s=amazon201209 header.b=Jb+yjW7W; spf=pass (google.com: domain of qemu-devel-bounces+alex.bennee=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+alex.bennee=linaro.org@nongnu.org"; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=amazon.de Received: from localhost ([::1]:39272 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1icVA0-0005cV-09 for alex.bennee@linaro.org; Wed, 04 Dec 2019 08:57:44 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:38528) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1icV8s-0005Lu-AO for qemu-devel@nongnu.org; Wed, 04 Dec 2019 08:56:35 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1icV8r-0005RR-7w for qemu-devel@nongnu.org; Wed, 04 Dec 2019 08:56:34 -0500 Received: from smtp-fw-2101.amazon.com ([72.21.196.25]:62079) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1icV8o-0005PN-UN; Wed, 04 Dec 2019 08:56:31 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amazon.de; i=@amazon.de; q=dns/txt; s=amazon201209; t=1575467791; x=1607003791; h=from:to:cc:subject:date:message-id:in-reply-to: references; bh=ZJTN+ohaJEyJa5Mz38YWX2orkNnDr5ayiRkSEay2Bdo=; b=Jb+yjW7WmxhOiBvSEB8HwP8Zi/Wdac+eksxvj7s/Wv5AQO12vILGGXg2 6cSq1q7qci2B/F0pamc4TDE9FNipZcajTaNOkfIQtvii+XZFNDExseP5h FvtmEb5lIs5zy03zaLHW0yw0B3aHJtdR05mqPdqaG4NRe/B4s5WVCm0yM 4=; IronPort-SDR: xAghjvXNYNirL+e0jZsjnDzVKkEodVBF1T9JaUN3H8Slhdwps/MZLMCnBH+oh0CIHOOs/1woY2 yi3yNajWEnlg== X-IronPort-AV: E=Sophos;i="5.69,277,1571702400"; d="scan'208";a="7106992" Received: from iad6-co-svc-p1-lb1-vlan2.amazon.com (HELO email-inbound-relay-2c-6f38efd9.us-west-2.amazon.com) ([10.124.125.2]) by smtp-border-fw-out-2101.iad2.amazon.com with ESMTP; 04 Dec 2019 13:56:29 +0000 Received: from sveith-desktop.aka.corp.amazon.com (pdx2-ws-svc-lb17-vlan2.amazon.com [10.247.140.66]) by email-inbound-relay-2c-6f38efd9.us-west-2.amazon.com (Postfix) with ESMTPS id DF7E8A1FAE; Wed, 4 Dec 2019 13:56:27 +0000 (UTC) Received: from sveith-desktop.aka.corp.amazon.com (localhost [127.0.0.1]) by sveith-desktop.aka.corp.amazon.com (8.15.2/8.15.2/Debian-3) with ESMTP id xB4DuQXE029431; Wed, 4 Dec 2019 14:56:26 +0100 Received: (from sveith@localhost) by sveith-desktop.aka.corp.amazon.com (8.15.2/8.15.2/Submit) id xB4DuQPZ029429; Wed, 4 Dec 2019 14:56:26 +0100 From: Simon Veith To: qemu-devel@nongnu.org, qemu-arm@nongnu.org Cc: Simon Veith , Eric Auger Subject: [PATCH 4/5] hw/arm/smmuv3: Use correct bit positions in EVT_SET_ADDR2 macro Date: Wed, 4 Dec 2019 14:55:47 +0100 Message-Id: <1575467748-28898-5-git-send-email-sveith@amazon.de> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1575467748-28898-1-git-send-email-sveith@amazon.de> References: <1575467748-28898-1-git-send-email-sveith@amazon.de> Precedence: Bulk X-detected-operating-system: by eggs.gnu.org: FreeBSD 9.x [fuzzy] X-Received-From: 72.21.196.25 X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+alex.bennee=linaro.org@nongnu.org Sender: "Qemu-devel" X-TUID: WreQIJmho7tV The bit offsets in the EVT_SET_ADDR2 macro do not match those specified in the ARM SMMUv3 Architecture Specification. In all events that use this macro, e.g. F_WALK_EABT, the faulting fetch address or IPA actually occupies the 32-bit words 6 and 7 in the event record contiguously, with the upper and lower unused bits clear due to alignment or maximum supported address bits. How many bits are clear depends on the individual event type. Update the macro to write to the correct words in the event record so that guest drivers can obtain accurate address information on events. ref. ARM IHI 0070C, sections 7.3.12 through 7.3.16. Signed-off-by: Simon Veith Cc: Eric Auger Cc: qemu-devel@nongnu.org Cc: qemu-arm@nongnu.org --- hw/arm/smmuv3-internal.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/hw/arm/smmuv3-internal.h b/hw/arm/smmuv3-internal.h index d190181..eb275e2 100644 --- a/hw/arm/smmuv3-internal.h +++ b/hw/arm/smmuv3-internal.h @@ -461,8 +461,8 @@ typedef struct SMMUEventInfo { } while (0) #define EVT_SET_ADDR2(x, addr) \ do { \ - (x)->word[7] = deposit32((x)->word[7], 3, 29, addr >> 16); \ - (x)->word[7] = deposit32((x)->word[7], 0, 16, addr & 0xffff);\ + (x)->word[7] = (uint32_t)(addr >> 32); \ + (x)->word[6] = (uint32_t)(addr & 0xffffffff); \ } while (0) void smmuv3_record_event(SMMUv3State *s, SMMUEventInfo *event); -- 2.7.4