Received: by 2002:ad5:4acb:0:0:0:0:0 with SMTP id n11csp4476876imw; Tue, 19 Jul 2022 07:20:16 -0700 (PDT) X-Google-Smtp-Source: AGRyM1vBkRE6sKrFsp6iTQTJeB802KAFldORxlscnhCmdzIvAy6tY3eVTpOhK2MMMclS59/muTnZ X-Received: by 2002:a05:6402:1d53:b0:43a:9ba7:315b with SMTP id dz19-20020a0564021d5300b0043a9ba7315bmr44582742edb.350.1658240416519; Tue, 19 Jul 2022 07:20:16 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1658240416; cv=none; d=google.com; s=arc-20160816; b=SY0wluZ7+jal4uyxBc0/7rtC7gu3TtQf8oQJIWxDc58QyKg8nh5qYP9fTY/bQEtjl0 5xZnbWdpqkQAwIb14LaNpJy843PWXShWtLf0ZVpcvVJKrxRtJwkXybrAyKWUG5FUMI5m hfgT3u/7lkpNxY6EG58fU4jYsAMZh0K9pcFGdUBpsyLpUw/pvOj15hZ0LKUT4xSp/ua9 1cFFPk3At/EZlk3iTyoVBGmTw/N1y5YFS+dsozalXwb+7J9OFs/f0oEK7dU7pLurvtY5 6nRqHxw/RLbpeNa++R1Rkh8SUgOFXtHR+I9tpf//E0x8Cx8V8UmVggTofh0MN2u6f7op WCtA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=kApmjSiob1ooaymDd94vv2NRzQusXFMzkemXWR3PPUk=; b=bQE1o2lwHHe1d0kAIYgLjFGl9YhpK26ETmhrKbdHY1wqxYH0opkiKAxTt4ZUldVKwC 2h1MCb9InU32R8eZ0UkWIX+UKNMolMmV0b80AY5iYId4Z8CY6T/NYlMaOmDVkXOAYzHZ qvoX8t3ips6i45ielq5rROHkkqQ7Jk33aVHvEwvWh3exg96GgONIrXFAOXc97I2giFb6 +o6TlA2whY3DDh09G2wCgDg2veZDfHYKFkTkW+SWj88uMEvNDe49jp8dr8HE6xyATAeP A5SdUaKuaQAqKDp6sRKxho+ZLOH1u2d9kyYDMbmAYWFnwLRGFkJM5sIArBzRGYCUrcJF tewA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=kQOfxJwc; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id f22-20020a056402329600b0043b96c391c7si1985469eda.156.2022.07.19.07.19.51; Tue, 19 Jul 2022 07:20:16 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=kQOfxJwc; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S241473AbiGSMnw (ORCPT + 99 others); Tue, 19 Jul 2022 08:43:52 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51076 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241504AbiGSMnU (ORCPT ); Tue, 19 Jul 2022 08:43:20 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B1BE3820CF; Tue, 19 Jul 2022 05:16:51 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 723AD6177F; Tue, 19 Jul 2022 12:16:51 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 506F8C341C6; Tue, 19 Jul 2022 12:16:50 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1658233010; bh=aArpVS4VNheVFDiOhTep3qwKK7+LFJJviBSs/dkrB5s=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=kQOfxJwcgOAOn4mLWU0nI4RYf8ShUIZd51CEg536nriggji2cJQcUYgPa+CxSroxw 4iojT38HxInoTbDMjAIyGY4wKWIUrDJ0Gc2/15nNibXpftrzWDpzSzautqC/kRyeaz S+nZc0SSAgrgyEjRXMRqMGDjDnS/4mkcF578jRx0= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Stephan Gerhold , "Michael S. Tsirkin" , Sasha Levin Subject: [PATCH 5.15 118/167] virtio_mmio: Restore guest page size on resume Date: Tue, 19 Jul 2022 13:54:10 +0200 Message-Id: <20220719114707.992732444@linuxfoundation.org> X-Mailer: git-send-email 2.37.1 In-Reply-To: <20220719114656.750574879@linuxfoundation.org> References: <20220719114656.750574879@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-7.8 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Stephan Gerhold [ Upstream commit e0c2ce8217955537dd5434baeba061f209797119 ] Virtio devices might lose their state when the VMM is restarted after a suspend to disk (hibernation) cycle. This means that the guest page size register must be restored for the virtio_mmio legacy interface, since otherwise the virtio queues are not functional. This is particularly problematic for QEMU that currently still defaults to using the legacy interface for virtio_mmio. Write the guest page size register again in virtio_mmio_restore() to make legacy virtio_mmio devices work correctly after hibernation. Signed-off-by: Stephan Gerhold Message-Id: <20220621110621.3638025-3-stephan.gerhold@kernkonzept.com> Signed-off-by: Michael S. Tsirkin Signed-off-by: Sasha Levin --- drivers/virtio/virtio_mmio.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/drivers/virtio/virtio_mmio.c b/drivers/virtio/virtio_mmio.c index 7522832529dd..fe696aafaed8 100644 --- a/drivers/virtio/virtio_mmio.c +++ b/drivers/virtio/virtio_mmio.c @@ -556,6 +556,9 @@ static int virtio_mmio_restore(struct device *dev) { struct virtio_mmio_device *vm_dev = dev_get_drvdata(dev); + if (vm_dev->version == 1) + writel(PAGE_SIZE, vm_dev->base + VIRTIO_MMIO_GUEST_PAGE_SIZE); + return virtio_device_restore(&vm_dev->vdev); } -- 2.35.1