From patchwork Thu Jun 7 13:38:04 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jia He X-Patchwork-Id: 10451883 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 49C5B6037F for ; Thu, 7 Jun 2018 13:39:54 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 36B8B29F57 for ; Thu, 7 Jun 2018 13:39:54 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 2903829F5D; Thu, 7 Jun 2018 13:39:54 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.8 required=2.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, MAILING_LIST_MULTI, RCVD_IN_DNSWL_HI, T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 6CA0929F57 for ; Thu, 7 Jun 2018 13:39:53 +0000 (UTC) Received: from localhost ([::1]:58037 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fQv8q-0007Eu-BH for patchwork-qemu-devel@patchwork.kernel.org; Thu, 07 Jun 2018 09:39:52 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:35216) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fQv7o-0006uz-TG for qemu-devel@nongnu.org; Thu, 07 Jun 2018 09:38:49 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fQv7o-0005bZ-2P for qemu-devel@nongnu.org; Thu, 07 Jun 2018 09:38:48 -0400 Received: from mail-pl0-x244.google.com ([2607:f8b0:400e:c01::244]:36942) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1fQv7j-0005Zr-Lc; Thu, 07 Jun 2018 09:38:43 -0400 Received: by mail-pl0-x244.google.com with SMTP id 31-v6so6169487plc.4; Thu, 07 Jun 2018 06:38:43 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id; bh=XT54n0bYpM7E7wU+jTQ0U7Co5cATAKNISde3IK9HpmY=; b=cSY4sWC2hd9C14hAqQdMQwMauerfE13mUiloqFrLcxOitVFTiexAKCs8srhzEzfwCw Ge4KHfmVntXFO2FNXNz4iK+eLypDc/3I4URRaYonFjzJKErzjsKAB8K4PM11mmJinTQq eP6C6L06EU72HW/DOxXWPx0Hs9nk96mfhl4rpZB2adLrXbpOxZNAVnLbWdxdAe9H4Kwj ps8dRN/Anjhdw5LQpuNF0dqGORn60WhxVtKvqKbgkaduQwMk1aEHfGS06ZsBo7zlG6gM ZrzcEjn2FQmpzRZpLEao+AQdBEl6vhdPBxJadpF7MUrd/4EFV5OCol4f/cB1DU15pPT4 lnYQ== 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; bh=XT54n0bYpM7E7wU+jTQ0U7Co5cATAKNISde3IK9HpmY=; b=fuEB8hZEfqAHb06PtDEbPNKTWQOmVfNsQR3K2t+55u/fcmIwhplJ7C1UhhdFZUSl9M AqMfetL08lQzsUjHl9N1ReAC25GzRklGXqu+z66bzShv3njgs412eIbAd/DvZne0ybJg 8FChWNcxBj4sj3/RHRS+ZUsLvGTERRnfZ86qJEFj3ywz+BnUPRED/13EgMeGQcE7oKxW cMmu6KGLVTdQablFEofs+FiHTgJ2SyFfkluYK3oxBXYTDrwj/fOWnjPjlD/Qf+4CVWKR AVJSJU3n9uPTzYKgURA257Vpzmpi3ZYIdquIesjotLcJU7DfbEAJppgbukeGfBWski0/ zraQ== X-Gm-Message-State: APt69E2q1buEWpzbxyccII0hd15Fh3du7iqdhEi4sas04RBzpXlAI9P7 oSKKMXPgmD0iHRNeBLD0dV8= X-Google-Smtp-Source: ADUXVKJLBT8sA2BCiVgq0FKSLNBsnRjt4sV+VEyC8scwoqKJ4Cm87l1khIko3072xukj8CafwUzqtw== X-Received: by 2002:a17:902:6bca:: with SMTP id m10-v6mr2131005plt.6.1528378722572; Thu, 07 Jun 2018 06:38:42 -0700 (PDT) Received: from ct7host.localdomain ([38.106.11.25]) by smtp.gmail.com with ESMTPSA id g80-v6sm34634393pfd.21.2018.06.07.06.38.39 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 07 Jun 2018 06:38:41 -0700 (PDT) From: Jia He To: Peter Maydell Date: Thu, 7 Jun 2018 21:38:04 +0800 Message-Id: <1528378684-14487-1-git-send-email-hejianet@gmail.com> X-Mailer: git-send-email 1.8.3.1 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] hw/arm/smmuv3: fix smmu emulation when guest smmu is in passthrough mode 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: jia.he@hxt-semitech.com, Jia He , qemu-arm@nongnu.org, qemu-devel@nongnu.org Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP There is an exception when I passes iommu.passthrough=1 to guest's kernel boot parameter(host QDF2400 kernel 4.17, guest kernel 4.14). The guest will be hang when booting up. When guest smmu is in passthrough mode, entry.perm will not be assigned to flag in smmuv3_translate. It seems not be correct. After this patch, I have tested in 4 cases and all passed. host smmu on/passthrough + guest smmu on/passthrough Signed-off-by: jia.he@hxt-semitech.com --- hw/arm/smmuv3.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/hw/arm/smmuv3.c b/hw/arm/smmuv3.c index 42dc521..5c46102 100644 --- a/hw/arm/smmuv3.c +++ b/hw/arm/smmuv3.c @@ -560,6 +560,12 @@ static IOMMUTLBEntry smmuv3_translate(IOMMUMemoryRegion *mr, hwaddr addr, } ret = smmuv3_decode_config(mr, &cfg, &event); + + if (cfg.bypassed) { + ret = 0; + goto out; + } + if (ret) { goto out; }