Received: by 2002:ad5:4acb:0:0:0:0:0 with SMTP id n11csp4372001imw; Tue, 19 Jul 2022 05:32:38 -0700 (PDT) X-Google-Smtp-Source: AGRyM1vRmLX95A9RqQPWqa9UBD/vYS+QR0Fdtps0XZ02us7j6DS0mw90vk0Vn9jzzkoRCyAOr+lA X-Received: by 2002:a17:907:1c97:b0:6f5:22ae:7024 with SMTP id nb23-20020a1709071c9700b006f522ae7024mr28828140ejc.570.1658233957840; Tue, 19 Jul 2022 05:32:37 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1658233957; cv=none; d=google.com; s=arc-20160816; b=kAPb+5CR30xT2XQRGLkxL95mDfLtsNrUm1c35Bz6gRKMfqs6nJs8mqnb2XIlQdMuxQ 0Jnfww7rDQv4khPjirAw8J2cHrfYGf2+DoKImw6cdV4w2xEPMsgLfreFwAq8ugfvQlTl xnflmz8YUCa4gCflxEFwPHzTjgMcFq6uLn9S4fYZO24qmA66oQbhRGmlls1MxlneyWUQ fbAHuUovVc2wnpq2LoPbhp6AvAW+isfN9auVj6twI1++8VJjjJRRKP+YH4sxO6adsl38 Pwh/jhCKDvqmTqkR17I7zHi7KS7E6TFNkqu0+oHemQvcHLXOhhpzZ/QVSR+zIlpjKSkZ Zilg== 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=8zrkpe6rG//R1jvpDuvGq3numqj7XD/Tl+q4G+iOca4=; b=hxQNI9ycXp1SMf/ocSc7V3PlYCUkY44l4r2GSRpeoLMDW9RW2xXFEhTlppmuOuXGMr UCWojd5wJrWZUkbGmX5m9eLFagbJlH6nVfkS0TyqOxmrljazlrJfqJ42d77+WBu2acsr twdQ9Qgce7WtU86C5ZBnSaCXQGnIn4+XRyMgQh1OcyJRP1c0kfX8llc0xR3a/d9jMCU/ RFMi/z0arfsp/nadHrRJzJh4ewd1BHNWYN3itCIVKGOmFqeF+dVaDpxlOBnraHoOuJ2d 2boXwL27LNEOm+SNhE0H8UB3yfAw1yB0jzxZixFR47dvVu7Fxom+bWsBP0VR2hRESop3 1NnQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=EMl+L0B5; 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 z21-20020a170906271500b00702d8b7438csi16102919ejc.326.2022.07.19.05.32.13; Tue, 19 Jul 2022 05:32:37 -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=EMl+L0B5; 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 S235506AbiGSL4P (ORCPT + 99 others); Tue, 19 Jul 2022 07:56:15 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54934 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237313AbiGSL4E (ORCPT ); Tue, 19 Jul 2022 07:56:04 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 21F37422CA; Tue, 19 Jul 2022 04:55:57 -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 ams.source.kernel.org (Postfix) with ESMTPS id 893B6B81B2C; Tue, 19 Jul 2022 11:55:55 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id A9D31C341C6; Tue, 19 Jul 2022 11:55:53 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1658231754; bh=KtcIH+E3c9VLP7E/93kgfkyPI4Y4Eqggbw0U3c+oQjc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=EMl+L0B5JKnlNm4uvu8j9wR5OhmaYAT8M/OfR3YxcCysj2c7OtQoUetDPJJLV3+9g oPQE8H1CzCJ+CTB+2Vrg1RkJjB0J6QKp8/ppGWuZhGtsojiMJNL/Ck/io3O6PmEZZd /ks2kNWJzcPzkhKZIJ35P+6G2RWycvt72dRg2KIk= 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 4.9 15/28] virtio_mmio: Restore guest page size on resume Date: Tue, 19 Jul 2022 13:53:53 +0200 Message-Id: <20220719114457.698901288@linuxfoundation.org> X-Mailer: git-send-email 2.37.1 In-Reply-To: <20220719114455.701304968@linuxfoundation.org> References: <20220719114455.701304968@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 d69f0c5135ff..413f6af4d132 100644 --- a/drivers/virtio/virtio_mmio.c +++ b/drivers/virtio/virtio_mmio.c @@ -502,6 +502,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