Received: by 2002:ad5:4acb:0:0:0:0:0 with SMTP id n11csp4431439imw; Tue, 19 Jul 2022 06:33:27 -0700 (PDT) X-Google-Smtp-Source: AGRyM1vLsX1gy6sUq6cM5W0unBoqPnn0lTPJ+p9jKz1OJhXWFm1fEBNrYwLVNJXIZ7xW7lLUA+X0 X-Received: by 2002:a17:906:ef90:b0:72b:50d5:7383 with SMTP id ze16-20020a170906ef9000b0072b50d57383mr30882156ejb.485.1658237606891; Tue, 19 Jul 2022 06:33:26 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1658237606; cv=none; d=google.com; s=arc-20160816; b=tmJ0T4NsJVrjx82CXJLotFotBH8Wv4GmwHB6TIW9XF1HD+zndtQ/xEGhxdG7qUcKSp T59quvJQBHuGFvSrL9J5OEi+PRrHk/pZ6RTzNdARMBYQIiN3t17Bi0SLwxUR+ldtum95 LnrJpKa1fSxZTArYNPcj7/Pvv+DF4Eil1Skciz1PpbpS106j+04iaF1kZYqjBgXsBeyp y0dfHMUkUWg2f+gO7E51ZkVVp+twWFhy9cXHve1p0iEjn3RsctHcHbewmUu9bdxkVw1q lIamqfLrd5kM6EQPLnggGNrB4zD+cyWyWU6d+areA8GDzbUyAcHCTc9kyjy03VBn0zjR WDDA== 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=btfgoayvdKweB+L910t6cj9W7/6P8W/GrDVmdFDSgdk=; b=YqcjFjmeHskg5H/ZaRZmPge/aTvvMhoUXMqHpy0TEtBuRaYAfwlJlqX76AK/i7uNKn XWODgfYCDFIZDG0QRvzWjDI4xqg5cf8VooANdjN06vakB0D0lTAzcGxZkLi8N1dod7bw IXNusECIyJjq0HG5yQfngebUKEYAD4745coVT+H6FzMyKelioeXLnT2PxF8dhYmPET5d rZC+KA3/gHDnswGu8P8JM56YSysoFGfAUw9QI7o0bPxUrwmuFdAWAyzPDpNe1yiSZin6 oFDbl1hnDk8XLbv6ViPooOZt0/oBHRF619V3Mrj3WkISMBE1xg0nOCW3gTvUZULiQNzR psKw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=MHgmke3T; 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 h7-20020a056402280700b0043a88f655efsi16876074ede.300.2022.07.19.06.33.02; Tue, 19 Jul 2022 06:33:26 -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=MHgmke3T; 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 S238870AbiGSMMO (ORCPT + 99 others); Tue, 19 Jul 2022 08:12:14 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51594 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238336AbiGSMKP (ORCPT ); Tue, 19 Jul 2022 08:10:15 -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 0ABA1422C5; Tue, 19 Jul 2022 05:03:20 -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 8559461632; Tue, 19 Jul 2022 12:03:19 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 6A4F8C341C6; Tue, 19 Jul 2022 12:03:18 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1658232198; bh=3Ebo41DSRWuzz7t4znUhen4wmpTzViKj875cur3+ojk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=MHgmke3TpXuTQtzF5lZZJXNgce2ygm2GAk3gr4TK1U3WgXpQ6c7KSJzPnEvfC4hkR Fcb0xTKpN7UA8Po27XFvySKBq2e95UHdodXf+0BFSgYzjyRwaa6D7aRgn1Hx+UT/yB OvQAmA7Ju/G/tlIYSiQsuuKQgE6RqCxYVL0mERAU= 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.4 46/71] virtio_mmio: Restore guest page size on resume Date: Tue, 19 Jul 2022 13:54:09 +0200 Message-Id: <20220719114556.781198549@linuxfoundation.org> X-Mailer: git-send-email 2.37.1 In-Reply-To: <20220719114552.477018590@linuxfoundation.org> References: <20220719114552.477018590@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 2a2d817caeff..e781e5e9215f 100644 --- a/drivers/virtio/virtio_mmio.c +++ b/drivers/virtio/virtio_mmio.c @@ -527,6 +527,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