From patchwork Sat Jun 30 00:02:41 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 140662 Delivered-To: patch@linaro.org Received: by 2002:a2e:9754:0:0:0:0:0 with SMTP id f20-v6csp1435912ljj; Fri, 29 Jun 2018 17:05:24 -0700 (PDT) X-Google-Smtp-Source: AAOMgpd6twak/aZ4mFmvWEEnoNMbtiiSh4RmALtXWOHYjpyewzq5736YhPYX2Ce3/FB8Y+IOqwLh X-Received: by 2002:a37:528b:: with SMTP id g133-v6mr14339700qkb.282.1530317124764; Fri, 29 Jun 2018 17:05:24 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1530317124; cv=none; d=google.com; s=arc-20160816; b=YokRqvRyxaawIX251lGBQX6OsxMQeoyXejnxVlSaCQEuONG4b3t77uxdlemYesjYzP WMM5MVv8pZG4oAu4NqPTK/hSUArsLYaHNmqMb6piEaLV51m8otKTCYN0tTHOrypY5U4W Cv7v1SYWL8J76DNeRBB/VAhSqc+3A/pCkhlKsP0jKZfDkNMZp88ftTQj7WJapK4ruTp3 ylJSV4x1tnGKnUDGS1zPHEUS7hDewSy3kCHf9V+symZusGBDrH6QQ1GDPne8/6TLtqAA U6fXy5YsKx3MXfQIW0C8z7E3ydIA4noismdrQiF8gVqp67vChqDTTUMxrPWUyP6ypgxD EHwQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:cc:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:subject:references:in-reply-to :message-id:date:to:from:dkim-signature:arc-authentication-results; bh=CJniO7UoFW9+5zglkjAGpzMZA9L0RVLuZLCX1WRXv+4=; b=V8ltBSwYqJ2frwTCmykDuff/iuuv2hFbssbvF7CVGUhYOZRY8z6fzgrKPZXqsVnBOf 0YVbSGk5/PZl5tkVuS7CjcsHdrvzjyoMpNviNDoDZqSF2IAQ4i50g5S+2ZukGiW4H94o GItA1HiaMzeDLExEAQGg3TjUpGh/NZ8gfIWeXcPoYBP/dTNLkJNLv5cfaFw1mpXvTvCi XLtHp8WvHaLphN3dqgtSjGNuLLJwTiKh3o3B39b2WfS7hbaapjO43ycF1ifmJuM+6zJR h9M9ogZdCJzH9S6RwhTaEuQpXF1zPs9r6FaEG/ji50vgl+YRjXYCeUj+8ywy9sdtnwx4 NaCw== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=Nys2lIcF; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 2001:4830:134:3::11 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [2001:4830:134:3::11]) by mx.google.com with ESMTPS id e7-v6si782932qkb.180.2018.06.29.17.05.24 for (version=TLS1 cipher=AES128-SHA bits=128/128); Fri, 29 Jun 2018 17:05:24 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 2001:4830:134:3::11 as permitted sender) client-ip=2001:4830:134:3::11; Authentication-Results: mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=Nys2lIcF; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 2001:4830:134:3::11 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1]:44952 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fZ3OG-000385-6h for patch@linaro.org; Fri, 29 Jun 2018 20:05:24 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:58280) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fZ3Lm-0002F3-Rq for qemu-devel@nongnu.org; Fri, 29 Jun 2018 20:02:51 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fZ3Lk-0007AA-TI for qemu-devel@nongnu.org; Fri, 29 Jun 2018 20:02:50 -0400 Received: from mail-pl0-x244.google.com ([2607:f8b0:400e:c01::244]:32984) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1fZ3Lk-00078k-Np for qemu-devel@nongnu.org; Fri, 29 Jun 2018 20:02:48 -0400 Received: by mail-pl0-x244.google.com with SMTP id 6-v6so5176599plb.0 for ; Fri, 29 Jun 2018 17:02:48 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=CJniO7UoFW9+5zglkjAGpzMZA9L0RVLuZLCX1WRXv+4=; b=Nys2lIcF+CSOjhSdolDP/yxaTFrpW9esjKiUWYJgBcAXUa1qZnG0ix8OQWSlZ9gjCg VlvKQOjMxKRAENbNU3UM9+8z6EPVijJzV02Rqp0gyn4S4DDkCJBBFX9TCsiQLsz14TYi aZsriE0+5He64OngvAMuZUcH7kS6ODMAJ6Jo0= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=CJniO7UoFW9+5zglkjAGpzMZA9L0RVLuZLCX1WRXv+4=; b=LQ4zDz+fc01JuXquI5bapghR0e5MMNxNzxuGq9DJRsISt95BLtnee6+S9/RRzENNO6 p7qsbt8bIwdm30EyqkFNv4DL5T07L/w2YWDXLgUsmBywGCzwViS2ZiFXzLZVQoEbtONx NgLI3UmCiTRSwZmd3CA9HA0DSjXBESaxTJZe2gKPIOVEgvS/RnVoCXTxQk9nMd1wc2vJ bBbRfUvUR3aE73ayakBPBLTK70QnewakO3YlcQeGaP2oaIgE962TRvFwmm7BmaIlHrHP Yl/r5Fg2y8ZlKvph+f8nS9U9J5FBBPH0XsNKyrX6qG99Jd4KQuL/J/5QQX1LddxvE812 bGbQ== X-Gm-Message-State: APt69E2gHYdMyYy9zgHIshD5vBCD9adxlcB34fCgxDlAqVLD6J+gc/Oy bAwDziSstEl28RjtVptyMSnWDfCgd94= X-Received: by 2002:a17:902:8bc6:: with SMTP id r6-v6mr16486733plo.257.1530316967487; Fri, 29 Jun 2018 17:02:47 -0700 (PDT) Received: from cloudburst.twiddle.net (97-126-112-211.tukw.qwest.net. [97.126.112.211]) by smtp.gmail.com with ESMTPSA id q19-v6sm15071915pff.9.2018.06.29.17.02.46 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Fri, 29 Jun 2018 17:02:46 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Date: Fri, 29 Jun 2018 17:02:41 -0700 Message-Id: <20180630000242.29594-2-richard.henderson@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20180630000242.29594-1-richard.henderson@linaro.org> References: <20180630000242.29594-1-richard.henderson@linaro.org> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2607:f8b0:400e:c01::244 Subject: [Qemu-devel] [PATCH 1/2] target/arm: Always return ARMASIdx_NS when num_ases == 1 X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: peter.maydell@linaro.org Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" Signed-off-by: Richard Henderson --- target/arm/cpu.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) -- 2.17.1 diff --git a/target/arm/cpu.h b/target/arm/cpu.h index e310ffc29d..c26cc43ea8 100644 --- a/target/arm/cpu.h +++ b/target/arm/cpu.h @@ -2915,7 +2915,7 @@ enum { /* Return the address space index to use for a memory access */ static inline int arm_asidx_from_attrs(CPUState *cs, MemTxAttrs attrs) { - return attrs.secure ? ARMASIdx_S : ARMASIdx_NS; + return cs->num_ases > 1 && attrs.secure ? ARMASIdx_S : ARMASIdx_NS; } /* Return the AddressSpace to use for a memory access From patchwork Sat Jun 30 00:02:42 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 140660 Delivered-To: patch@linaro.org Received: by 2002:a2e:9754:0:0:0:0:0 with SMTP id f20-v6csp1434137ljj; Fri, 29 Jun 2018 17:03:14 -0700 (PDT) X-Google-Smtp-Source: AAOMgpfGJwYVcx6IjneUK9+/ecxu3hGFCjINrhY9BOAjwHdEq/1znppadGyilb6HsUc9IxQvwbSQ X-Received: by 2002:ac8:950:: with SMTP id z16-v6mr15710094qth.299.1530316994584; Fri, 29 Jun 2018 17:03:14 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1530316994; cv=none; d=google.com; s=arc-20160816; b=j+BDIoxQfIaEENaiOorL9hdcgeGkqnHDd0P0IMpdYbIpn1CQUjFN4Q7LAoYV9oGsT6 BI2pRdZ2B3tTKJlFoo06+sq5Q/dx4tvasVHpQDfButXcWWkv5d2SGfy7+yTcs4awXLi4 oM4jQ94njFXax5AF+BKx8kPXy4ngx0D2KTngFz6CiInbrtuyuys8r+w9pPPIvwMzp/yl QNpACWw4tquWPabDNqFEpj4D0smUMZt9o+9uwiTxgKEheGFGWYhoteZ3hoGk9Ypg0NgS YoMpldxvO0VdI8uguR1LjGajVS2ZwnXFcgtXoFwm8gyNldB7CLaYfs5bdQ+HwHchG1AR Ar8g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:cc:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:subject:references:in-reply-to :message-id:date:to:from:dkim-signature:arc-authentication-results; bh=slA9cJAs5lmcJRGhC7kyYr2fVC3gFvohw8p3sfwsLfE=; b=Dxck2ter/E4a8ismxq+/2F0uLpNR1ownSa8BmZoFg4km41GhUh/yYhlN4ztSNg0FXz 1/3hgyRkRbljnuOzQf5V0rh903xeiXa7daHNChYI/cGvxeHjrfSojfko6VIFRkboaVvl WeFJKtWF5mzlD4BTq9AZRXaPBwOJn9eETx58NyUqhGmfxOSA4hfxd+uv075qegqAWz2q Zu9HMghBdnoTERzZ7HiYkdNMSWw2XmLADeUPZQJYzl9mobzZ+IkrLPR/SY1rWFAE0Dfu ICLq8p9u1wAM36vmQCy2nSKNs7NnaJb0PzklGNUj9uznSvFt9dUjwBf/MGUzklh976Gb R7mA== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=IJq5wFwB; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 2001:4830:134:3::11 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [2001:4830:134:3::11]) by mx.google.com with ESMTPS id o39-v6si4366008qtf.75.2018.06.29.17.03.14 for (version=TLS1 cipher=AES128-SHA bits=128/128); Fri, 29 Jun 2018 17:03:14 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 2001:4830:134:3::11 as permitted sender) client-ip=2001:4830:134:3::11; Authentication-Results: mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=IJq5wFwB; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 2001:4830:134:3::11 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1]:44946 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fZ3MA-0002FI-1j for patch@linaro.org; Fri, 29 Jun 2018 20:03:14 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:58284) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fZ3Lm-0002F5-Sr for qemu-devel@nongnu.org; Fri, 29 Jun 2018 20:02:51 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fZ3Lm-0007CM-22 for qemu-devel@nongnu.org; Fri, 29 Jun 2018 20:02:50 -0400 Received: from mail-pl0-x242.google.com ([2607:f8b0:400e:c01::242]:38980) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1fZ3Ll-0007Az-TQ for qemu-devel@nongnu.org; Fri, 29 Jun 2018 20:02:50 -0400 Received: by mail-pl0-x242.google.com with SMTP id s24-v6so5168348plq.6 for ; Fri, 29 Jun 2018 17:02:49 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=slA9cJAs5lmcJRGhC7kyYr2fVC3gFvohw8p3sfwsLfE=; b=IJq5wFwB7Ba7XErFxj2pqVAwR03G7U3/+vACqRsK60s3sm4uV65z6jKki2RxsS8+gZ qNSNtFBLIOx4kFrbyvIZGfDkIGMUiuqTQxCbV1NxC5QShjDotz3dVjsJRhfPxDWq44so BByiKqNVGK3DGyNqeiH/WFao3GyAcdP5jhb20= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=slA9cJAs5lmcJRGhC7kyYr2fVC3gFvohw8p3sfwsLfE=; b=HWKYVEDRBuTOKkE2KZQq5H0GqkMBnZXb0RPJCF4PRLQMvuD4uK2/MCvZKpia13zPl/ eIB6ngM8Aa/VANzlN1ZXExUqjJCNUQ+runTFpqA+VkL+qIzyzcANKY01duBG31LdHys6 F+d7LYB4fuphITQsPGllphHHeGSJWgyipoXZL90ZvdZg6iV47/eLSk6kLa4H/Krcy8nm c4gQfC4ib8TZ8kOhp4e+MnL96vBqXTA4ToSJnQkRj+BLcFEQj+t8iKH5Myg3HuXwPT+a FYBCY4bKV+/uIJtwb5CM3sVmcgsL2HP10EwYkv1SMRlTzUYQxehEODbESV4ON3rUPCZz QrfA== X-Gm-Message-State: APt69E0zeux1vQY9+nkHGxMMpRlHQlg8k2Yu6e3dfxshmx9iVWSqWb56 +uwj33hIkPQxkor5mTiRxWpVM+khm9Y= X-Received: by 2002:a17:902:585:: with SMTP id f5-v6mr16952919plf.142.1530316968675; Fri, 29 Jun 2018 17:02:48 -0700 (PDT) Received: from cloudburst.twiddle.net (97-126-112-211.tukw.qwest.net. [97.126.112.211]) by smtp.gmail.com with ESMTPSA id q19-v6sm15071915pff.9.2018.06.29.17.02.47 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Fri, 29 Jun 2018 17:02:47 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Date: Fri, 29 Jun 2018 17:02:42 -0700 Message-Id: <20180630000242.29594-3-richard.henderson@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20180630000242.29594-1-richard.henderson@linaro.org> References: <20180630000242.29594-1-richard.henderson@linaro.org> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2607:f8b0:400e:c01::242 Subject: [Qemu-devel] [PATCH 2/2] cpu: Assert asidx_from_attrs return value in range X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: peter.maydell@linaro.org Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" Signed-off-by: Richard Henderson --- include/qom/cpu.h | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) -- 2.17.1 Reviewed-by: Peter Maydell diff --git a/include/qom/cpu.h b/include/qom/cpu.h index cce2fd6acc..bd796579ee 100644 --- a/include/qom/cpu.h +++ b/include/qom/cpu.h @@ -620,11 +620,13 @@ static inline hwaddr cpu_get_phys_page_debug(CPUState *cpu, vaddr addr) static inline int cpu_asidx_from_attrs(CPUState *cpu, MemTxAttrs attrs) { CPUClass *cc = CPU_GET_CLASS(cpu); + int ret = 0; if (cc->asidx_from_attrs) { - return cc->asidx_from_attrs(cpu, attrs); + ret = cc->asidx_from_attrs(cpu, attrs); + assert(ret < cpu->num_ases && ret >= 0); } - return 0; + return ret; } #endif