Received: by 2002:ad5:4acb:0:0:0:0:0 with SMTP id n11csp4449997imw; Tue, 19 Jul 2022 06:53:14 -0700 (PDT) X-Google-Smtp-Source: AGRyM1vH9AFXf78Tp9ZuLJm86H5pNJqW0cDF5oFHE+t9MF8BgA9T5nAMlcY53FCevHE+ams4CsWK X-Received: by 2002:a17:906:4fc4:b0:6da:b4c6:fadb with SMTP id i4-20020a1709064fc400b006dab4c6fadbmr30562367ejw.282.1658238794205; Tue, 19 Jul 2022 06:53:14 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1658238794; cv=none; d=google.com; s=arc-20160816; b=euc109bmCf0vgzwFB3eqSdNSrwsNy2/gJeDfLpnVEPG15tGUSvV2FzKK3yu/pA0FEV OextSqaDdBw0Xz/ZkV6HYfitga4fLjSRQyWoUmU4iRnkC2lNsCaOF7I1c+VwyCbXsTPT YeKsy+gEqcgNpHN1bJmbttST7X0l5lhDgJkLsMUsdvCoqnj0J4YTy61iwgKj5p+rrF4o gwdMANrA6lQ+EJ1foLcRVB6UZbIS/8OAKLgylvnjvFwHV8VcEvsHSc5jQexdgj0/KicP nv58yf00JuSSZvBhv03npBZKBl4cscu86ZMsV2bu4x23V2hZ5DOoOq+zaaWmcKAiUi6c 5aLQ== 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=KzDhCGwcJZ2Wbi49MRM/Lei7wsSTWgK7ImIRiNo9llc=; b=D9GMq0DoRLaE7kxRMIYFephhSohY5xGa7w+cIHzE+mLw9M8Wt7ZdjcXFz+kgIR/l+D shwRQqOwYzQrR0WIVtD0b/kBEW+IXh7tgNmRX2/4D4C5B5v7oQJBNuu3ssqiuVFQ0OSm pO1JDt06Q9aKodF4ZHHCLc5w6Zb3Rpie2zDbk6nARAOlViykP+Va1TIFE733yoCwo5nK NlbfGdqZgOO2jq7PyPXDZmukYhfWfnFVrwROilaZIj6NsG1mIT6HkUvclm+l1KbkqmrW zBnkfxAmbxe1zSv328s7emS0uHc4JVascRlwofLT3aL5MQDkTk8ton80I87ZnEOVLz9f wJkw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=S+AblGOf; 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 hs2-20020a1709073e8200b0072b81296609si23250984ejc.64.2022.07.19.06.52.49; Tue, 19 Jul 2022 06:53:14 -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=S+AblGOf; 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 S238487AbiGSMIZ (ORCPT + 99 others); Tue, 19 Jul 2022 08:08:25 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51526 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238391AbiGSMID (ORCPT ); Tue, 19 Jul 2022 08:08:03 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 59BB04F1B2; Tue, 19 Jul 2022 05:01:29 -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 C1BB2616F9; Tue, 19 Jul 2022 12:01:27 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 8DBB3C341CA; Tue, 19 Jul 2022 12:01:26 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1658232086; bh=mRSL+apNKrvio6NVOXKtCrU99U9hQ2heTqOSh0hWygI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=S+AblGOfiKS2UUNavQ8IGVvpWwTHW4NAfVre0Z/rrsYXQa8q0X9S1s+yKapkof6LX cEWNx0QUdi/+zfJIMcdFl5lIbx90WuRnavpMVohPmX8V4Hl4WMo1q6+DwJUGq4lsGA UhJToUnkB2d9rdNJGl3SSaVRvi8T0MhtcDMQH5Ck= 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.19 28/48] virtio_mmio: Restore guest page size on resume Date: Tue, 19 Jul 2022 13:54:05 +0200 Message-Id: <20220719114522.416986218@linuxfoundation.org> X-Mailer: git-send-email 2.37.1 In-Reply-To: <20220719114518.915546280@linuxfoundation.org> References: <20220719114518.915546280@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 79474bd0c52c..17cd682acc22 100644 --- a/drivers/virtio/virtio_mmio.c +++ b/drivers/virtio/virtio_mmio.c @@ -521,6 +521,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