From patchwork Tue Aug 14 18:17:36 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 144209 Delivered-To: patch@linaro.org Received: by 2002:a2e:9754:0:0:0:0:0 with SMTP id f20-v6csp4706073ljj; Tue, 14 Aug 2018 11:36:19 -0700 (PDT) X-Google-Smtp-Source: AA+uWPysGtLsS8MoORzA/rgwV8I1/cR3gWIBvcuIkbK13wd0dKGVOUgv77fve3S9zPhtDzYdYaFH X-Received: by 2002:ac8:3872:: with SMTP id r47-v6mr22141758qtb.69.1534271779172; Tue, 14 Aug 2018 11:36:19 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1534271779; cv=none; d=google.com; s=arc-20160816; b=RPW3b+5Hi1IQtSwdoyMsDU1CCIryHTLfeV6+KwDGKlL5yQvwAV+LEDZJ9LLtmv6xsq 8MUQeBWGtX9OYp85UHyyZystxVvxUS0S2ZlnLGypRudTcjEuJZRHMPkWG1+cmdXjCmWg 7fAQNta1UEYf6/jSuMkMMPTja0omo0G7z6KOvbUhkLcM/iCoio/hVZytQUW0GTf6J4gy eWF6OztVwE0VeEjM5gUY1XP81soBudFXBzhbsAiRFjt54IZcDEOBH2eGzsb3ygKz0hlr Boa+cCOr98SgDqtkRtcfnwav/r420Yk9v6bCpEBacoJrAuJVAbht70Td6OaoC/T+B1P7 EF8A== 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:subject :content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:to:from:arc-authentication-results; bh=dXIfqpFosJmtr0jo6Ud4i3clsvEywT3MH5fQFxJxgbA=; b=aXxPzBnEYR3osrE8ET0+O9kYQTtOxC+Bxgsv6TV7Bsg3n9f1baINC3wK3cB9UMHCAv XtKMt+dX2a41QzsAtlQyn8LJlDTxABEQ1lJm5VxOn7DYt6Ef+WO2jnZb11hG+hEAa2zQ b+7Pl84V8j5zAytzpH1OjGBKVXd7sEA4xqOu8NP6bTrVwjnggMsMt2AZ7UID4ABKyzF6 doyHNAobwSFsgqSuJbw8lzJs4SSvynWLOaMFLYdw36inEHkYIcVqmD0Pl3JGEeKvVdpZ 2zzUmHzA671+I9WjnTy2fZEFRfj/ViBkpyN33lEREP+vALWpJedW1pqMvtMm9Mvk1/UR 9f8A== ARC-Authentication-Results: i=1; mx.google.com; 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 v10-v6si5838551qvn.266.2018.08.14.11.36.18 for (version=TLS1 cipher=AES128-SHA bits=128/128); Tue, 14 Aug 2018 11:36:19 -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; 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]:45688 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fpeB0-0007jF-Hw for patch@linaro.org; Tue, 14 Aug 2018 14:36:18 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:52350) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fpduq-0004PP-M1 for qemu-devel@nongnu.org; Tue, 14 Aug 2018 14:21:19 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fpdti-0006X8-Lc for qemu-devel@nongnu.org; Tue, 14 Aug 2018 14:19:36 -0400 Received: from orth.archaic.org.uk ([2001:8b0:1d0::2]:44400) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1fpdti-0006Ug-6z for qemu-devel@nongnu.org; Tue, 14 Aug 2018 14:18:26 -0400 Received: from pm215 by orth.archaic.org.uk with local (Exim 4.89) (envelope-from ) id 1fpdtg-00079C-PM for qemu-devel@nongnu.org; Tue, 14 Aug 2018 19:18:24 +0100 From: Peter Maydell To: qemu-devel@nongnu.org Date: Tue, 14 Aug 2018 19:17:36 +0100 Message-Id: <20180814181815.23348-7-peter.maydell@linaro.org> X-Mailer: git-send-email 2.18.0 In-Reply-To: <20180814181815.23348-1-peter.maydell@linaro.org> References: <20180814181815.23348-1-peter.maydell@linaro.org> MIME-Version: 1.0 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2001:8b0:1d0::2 Subject: [Qemu-devel] [PULL 06/45] accel/tcg: Handle get_page_addr_code() returning -1 in hashtable lookups 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: , Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" When we support execution from non-RAM MMIO regions, get_page_addr_code() will return -1 to indicate that there is no RAM at the requested address. Handle this in the cpu-exec TB hashtable lookup code, treating it as "no match found". Note that the call to get_page_addr_code() in tb_lookup_cmp() needs no changes -- a return of -1 will already correctly result in the function returning false. Signed-off-by: Peter Maydell Reviewed-by: Richard Henderson Reviewed-by: Emilio G. Cota Tested-by: Cédric Le Goater Message-id: 20180710160013.26559-3-peter.maydell@linaro.org --- accel/tcg/cpu-exec.c | 3 +++ 1 file changed, 3 insertions(+) -- 2.18.0 diff --git a/accel/tcg/cpu-exec.c b/accel/tcg/cpu-exec.c index c738b7f7d6e..6bcb6d99bd7 100644 --- a/accel/tcg/cpu-exec.c +++ b/accel/tcg/cpu-exec.c @@ -332,6 +332,9 @@ TranslationBlock *tb_htable_lookup(CPUState *cpu, target_ulong pc, desc.trace_vcpu_dstate = *cpu->trace_dstate; desc.pc = pc; phys_pc = get_page_addr_code(desc.env, pc); + if (phys_pc == -1) { + return NULL; + } desc.phys_page1 = phys_pc & TARGET_PAGE_MASK; h = tb_hash_func(phys_pc, pc, flags, cf_mask, *cpu->trace_dstate); return qht_lookup_custom(&tb_ctx.htable, &desc, h, tb_lookup_cmp);