From patchwork Tue Mar 12 10:55:41 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: =?utf-8?q?Alex_Benn=C3=A9e?= X-Patchwork-Id: 160086 Delivered-To: patch@linaro.org Received: by 2002:a02:5cc1:0:0:0:0:0 with SMTP id w62csp12967643jad; Tue, 12 Mar 2019 04:05:05 -0700 (PDT) X-Google-Smtp-Source: APXvYqyAPqqpVEmB0yGQyFt1lS6t2GbxZYDF6iYLAYZg9sRzUqRc+iTiN5Nlwib6q5evStmfAo5G X-Received: by 2002:a25:bdcb:: with SMTP id g11mr11590238ybk.227.1552388705632; Tue, 12 Mar 2019 04:05:05 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1552388705; cv=none; d=google.com; s=arc-20160816; b=fUTHtW2LGRzfr8E7jdcPLfcJ5QKnyikK8tJ4Qf3hOYUU2Od/PbvH9M642LnhA5wovb XirkJEN1UBBXO40daAvJpb6uIFwpcJKfPV2MM92dbfvsM5+tLkh5PN3zed9LTT1EC6+C e5zfUdB1x3WluELuWViWu/uS/+YgfBB5EjFZk1HUXeqAfuqV0j/XKAT3cthb2ohtbBQQ dc/8NMF/RrHNI+Ecx6nhe86bDoN6Ik6+GtoyTtVrZKRGX+aDuxx6kY/CZhfcj2ZSCBbm AOUrGrAyokgbe50UvULfYh+DOHnBYQeIJb1X3YA6eRbyCOsidWZZfpv2L9JJBS3oIJUW m6Vg== 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 :content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:to:from:dkim-signature; bh=JChXdfWELr9fgYHxM6rVjpoCB7MX+rUfE6XqM9PnHuQ=; b=QhPgymjFGFFr7eLl7+LYlMjUgz0hXQy/+2ihsbQQutjS2O3uHGcM8YkqHZs8vsU6lV jO0ACwBUCrBFZTZyGs3AtRFtZRFyE7QZxtAA2qotjqxxb9KvR4rxg5LJzmSjpIsFWK2Z SOyOEdUylf0FVW/fO4aCl1QOZRKlITopTxONqB68Hw4sMi0pZET1nDex6QdSvvlcws5T Rq1itYH2nhQVTqQbyQwKARq4CSrxB3DIGrggix84vbEhQCZes/pmOdpRX6h0QN9c1zma sI4QKDEjoQloD0UJuhLcKJ6odMp2WS3Ub/Q3ZdQatNWTQdHflM6VLR/3xiz9vSYCSHIW eLYQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=xJ8u6w5z; 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=fail (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 a3si689802ybm.275.2019.03.12.04.05.05 for (version=TLS1 cipher=AES128-SHA bits=128/128); Tue, 12 Mar 2019 04:05:05 -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=fail header.i=@linaro.org header.s=google header.b=xJ8u6w5z; 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=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([127.0.0.1]:49838 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1h3fDV-0001B9-2f for patch@linaro.org; Tue, 12 Mar 2019 07:05:05 -0400 Received: from eggs.gnu.org ([209.51.188.92]:50456) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1h3f4e-0002Xk-62 for qemu-devel@nongnu.org; Tue, 12 Mar 2019 06:55:57 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1h3f4c-0003az-Ni for qemu-devel@nongnu.org; Tue, 12 Mar 2019 06:55:56 -0400 Received: from mail-wm1-x341.google.com ([2a00:1450:4864:20::341]:54687) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1h3f4a-0003YX-Jx for qemu-devel@nongnu.org; Tue, 12 Mar 2019 06:55:52 -0400 Received: by mail-wm1-x341.google.com with SMTP id f3so2128962wmj.4 for ; Tue, 12 Mar 2019 03:55:50 -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 :mime-version:content-transfer-encoding; bh=JChXdfWELr9fgYHxM6rVjpoCB7MX+rUfE6XqM9PnHuQ=; b=xJ8u6w5zvUajKk1Nz2P8UNJmJMulbrw9RaK88l0X+Wqh/74WtE7rFb5aZH5pmGfO3s NvgRL4PbQYnxeeqBjtfjn3zZVZTGIRfNz76/SNSK25JPzpkO1l8vDjmrMceIEHiC4WFE YRGWzt47OPCJ7LFxWJnH9wLwdKQJiwjNtLRwfe3G0rrImnTY8bQLX2g1KOMe82b54wwy gNUGVJID2RhoUZ66N8XBSzMzMkwBjtgB4Gwa5DWZ0I7rG6R7hXPtv2Y31cN660nJLHPL EdrTRDu2cLrMOBydRwFt6y/cMcOAaLqTt0LX8jCqHnZR9GF0kJejrfVkR5t/GMHuNcP+ Fc8g== 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:mime-version:content-transfer-encoding; bh=JChXdfWELr9fgYHxM6rVjpoCB7MX+rUfE6XqM9PnHuQ=; b=pQetU+bLqw9dEelYPOjTpxXrwjHBztHN+Ihy9c50qSUQMuIntX2Vvqi1GZK89/klRc 79Zqq6gVRzHORMAhCSd5qSWm236+0ZRDUJvePoes28+v700EJ6gYBc31USS6XDQYuG4g zLRCsJKHM3Xj5axQRvDXv7ZiHQiKWew3eHiVi/x8pLMEgubSHWCdrSDSrsLFbR8ldwI3 bq+U7J3RDUhvfcJACrxGxKbZuhY0ryU0Q9Dgl1MzqSvNpiXJ1Yk98CvhF8DeJTbBDwow zCeE5KLGOyRnMeKiB2V+dRbuQ6PldNQ3lVTzQZeX/0pS1PDqLOrfxuOuF5Qqmgn7yVzP S/ow== X-Gm-Message-State: APjAAAWGGe5LKZixC7WbZBrG1VYBFjt2HpsVHk8jBToXL8XqNraTst7T 52X6JwYkF1XzwwSqAuhPbHNR6wav3vY= X-Received: by 2002:a1c:4e09:: with SMTP id g9mr1834252wmh.56.1552388149203; Tue, 12 Mar 2019 03:55:49 -0700 (PDT) Received: from zen.linaroharston ([81.128.185.34]) by smtp.gmail.com with ESMTPSA id w14sm14293548wrr.18.2019.03.12.03.55.47 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Tue, 12 Mar 2019 03:55:47 -0700 (PDT) Received: from zen.linaroharston. (localhost [127.0.0.1]) by zen.linaroharston (Postfix) with ESMTP id 985EE1FF89; Tue, 12 Mar 2019 10:55:47 +0000 (UTC) From: =?utf-8?q?Alex_Benn=C3=A9e?= To: qemu-devel@nongnu.org Date: Tue, 12 Mar 2019 10:55:41 +0000 Message-Id: <20190312105547.4755-2-alex.bennee@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190312105547.4755-1-alex.bennee@linaro.org> References: <20190312105547.4755-1-alex.bennee@linaro.org> MIME-Version: 1.0 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:4864:20::341 Subject: [Qemu-devel] [PATCH v2 1/7] spapr: Simulate CAS for qtest 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, David Gibson , Greg Kurz , Michael Roth Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" From: Greg Kurz The RTAS event hotplug code for machine types 2.8 and newer depends on the CAS negotiated ov5 in order to work properly. However, there's no CAS when running under qtest. There has been a tentative to trick the code by faking the OV5_HP_EVT bit, but it turned out to break other assumptions in the code and the change got reverted. Go for a more general approach and simulate a CAS when running under qtest. For simplicity, this pseudo CAS simple simulates the case where the guest supports the same features as the machine. It is done at reset time, just before we reset the DRCs, which could potentially exercise the unplug code. This allows to test unplug on spapr with both older and newer machine types. Suggested-by: Michael Roth Signed-off-by: Greg Kurz Message-Id: <155146875704.147873.10563808578795890265.stgit@bahia.lan> Tested-by: Michael Roth Reviewed-by: Michael Roth Signed-off-by: David Gibson --- hw/ppc/spapr.c | 11 +++++++++++ 1 file changed, 11 insertions(+) -- 2.20.1 diff --git a/hw/ppc/spapr.c b/hw/ppc/spapr.c index 9e01226e18..f7d527464c 100644 --- a/hw/ppc/spapr.c +++ b/hw/ppc/spapr.c @@ -29,6 +29,7 @@ #include "qapi/visitor.h" #include "sysemu/sysemu.h" #include "sysemu/numa.h" +#include "sysemu/qtest.h" #include "hw/hw.h" #include "qemu/log.h" #include "hw/fw-path-provider.h" @@ -1711,6 +1712,16 @@ static void spapr_machine_reset(void) */ spapr_irq_reset(spapr, &error_fatal); + /* + * There is no CAS under qtest. Simulate one to please the code that + * depends on spapr->ov5_cas. This is especially needed to test device + * unplug, so we do that before resetting the DRCs. + */ + if (qtest_enabled()) { + spapr_ovec_cleanup(spapr->ov5_cas); + spapr->ov5_cas = spapr_ovec_clone(spapr->ov5); + } + /* DRC reset may cause a device to be unplugged. This will cause troubles * if this device is used by another device (eg, a running vhost backend * will crash QEMU if the DIMM holding the vring goes away). To avoid such