From mboxrd@z Thu Jan 1 00:00:00 1970 Received: by 2002:ac2:5937:0:0:0:0:0 with SMTP id v23csp281816lfi; Wed, 1 Apr 2020 00:46:16 -0700 (PDT) X-Google-Smtp-Source: ADFU+vv3p0qVbt0DaGXuzRIafHRHXrO4inhaPenD2b2gFMQlXD1vVHEMXezMLIQQC1Xf5TGToppd X-Received: by 2002:ae9:e30c:: with SMTP id v12mr8203235qkf.405.1585727176432; Wed, 01 Apr 2020 00:46:16 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1585727176; cv=none; d=google.com; s=arc-20160816; b=hTk5iOCQ5M2dQ6jwQF32v3+aVpB6O7RIXquyYK91B4P6wDg8yBCpawtRzfzaZ2+nKo 754vzbU5jh8vt5mgdg4Q7o++xwymnYufMEFxPgfax0b/C5pT8JNp3Klmg30pjgJfQ43j Hwhzz4cYciyJ7AQEpDnZLLM2DtWrHYBx1VpnxIvUYOH6IELmI4vs5XTqf6VkTMPW678n xUJuAxzGEN6GrjWpp//GxOqqNIvVota6xqH232Kc6oiRpa4bvR+nMlQiLw2PAszw9rrV 6y0YaYyl7HApmBENiD9ocYyU0weYshHHE5uzJsz6tdAPpewE2IOPZriTSy6hLBWsaMDr 189A== 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:mime-version :content-transfer-encoding:content-language:accept-language :in-reply-to:references:message-id:date:thread-index:thread-topic :subject:to:from; bh=+6VF2zHVn29SUJ1M1xipDRaFanUk7YJDq5QGEQi1MrA=; b=yOoFr9wpTtw0YBtNHk1VKh6YWf9kBX+Pvo8Kx1oldluOZbFWqxujMswRmbl5M1YCcg RphXQnWtKxJyMDmxpaQr+tR4AERmhwlCWEk+zlAzaydpMSAbbSISZSN1mcsCWJslrdOG tzJS6CaSJsZBvUhQrHXcJabXWfmT/hYBfspVADMy1dd7ycSvP6V4rnoC7XN782Zlck5O vozA3ibwD4EO8REdMaU6w20tw0Ze6um2BmKlq2n0p9ba6IVlMpFzDgfjDAHkhuzoOCYa roVfXEQiELciLMyfrqxNRlm+S1fdao0wmlsdLQ67hINhYf4GbfuTKagcnAKyaTLGC8Sk BVgQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of qemu-arm-bounces+alex.bennee=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-arm-bounces+alex.bennee=linaro.org@nongnu.org" Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id o28si938681qtl.163.2020.04.01.00.46.16 for (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Wed, 01 Apr 2020 00:46:16 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-arm-bounces+alex.bennee=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; spf=pass (google.com: domain of qemu-arm-bounces+alex.bennee=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-arm-bounces+alex.bennee=linaro.org@nongnu.org" Received: from localhost ([::1]:48494 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jJY4l-0001Gg-Qa for alex.bennee@linaro.org; Wed, 01 Apr 2020 03:46:15 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:54133) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jJY4K-0001GX-UN for qemu-arm@nongnu.org; Wed, 01 Apr 2020 03:45:50 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1jJY4J-0005a5-Bz for qemu-arm@nongnu.org; Wed, 01 Apr 2020 03:45:48 -0400 Received: from lhrrgout.huawei.com ([185.176.76.210]:2093 helo=huawei.com) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1jJY4J-0005U9-5s; Wed, 01 Apr 2020 03:45:47 -0400 Received: from lhreml701-chm.china.huawei.com (unknown [172.18.7.107]) by Forcepoint Email with ESMTP id A4C7C2BA23BF1D9B6319; Wed, 1 Apr 2020 08:45:40 +0100 (IST) Received: from lhreml710-chm.china.huawei.com (10.201.108.61) by lhreml701-chm.china.huawei.com (10.201.108.50) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1713.5; Wed, 1 Apr 2020 08:45:40 +0100 Received: from lhreml710-chm.china.huawei.com ([169.254.81.184]) by lhreml710-chm.china.huawei.com ([169.254.81.184]) with mapi id 15.01.1713.004; Wed, 1 Apr 2020 08:45:40 +0100 From: Shameerali Kolothum Thodi To: "Dr. David Alan Gilbert" Subject: RE: [PATCH for-5.0 2/3] fw_cfg: Migrate ACPI table mr sizes separately Thread-Topic: [PATCH for-5.0 2/3] fw_cfg: Migrate ACPI table mr sizes separately Thread-Index: AQHWBrNmc/8JhbZhOkGXkACpglv9b6hidOOAgAFv16A= Date: Wed, 1 Apr 2020 07:45:40 +0000 Message-ID: <5d1f524257f446bebda5d27e571abbfe@huawei.com> References: <20200330164909.28324-1-shameerali.kolothum.thodi@huawei.com> <20200330164909.28324-3-shameerali.kolothum.thodi@huawei.com> <20200331104543.GA2942@work-vm> In-Reply-To: <20200331104543.GA2942@work-vm> Accept-Language: en-GB, en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [10.47.88.147] Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-CFilter-Loop: Reflected X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 185.176.76.210 X-BeenThere: qemu-arm@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: "peter.maydell@linaro.org" , "xiaoguangrong.eric@gmail.com" , "david@redhat.com" , "shannon.zhaosl@gmail.com" , "mst@redhat.com" , "qemu-devel@nongnu.org" , Linuxarm , "eric.auger@redhat.com" , "qemu-arm@nongnu.org" , "xuwei \(O\)" , "imammedo@redhat.com" , "lersek@redhat.com" Errors-To: qemu-arm-bounces+alex.bennee=linaro.org@nongnu.org Sender: "Qemu-arm" X-TUID: Aa+vNNfKa4MG > -----Original Message----- > From: Dr. David Alan Gilbert [mailto:dgilbert@redhat.com] > Sent: 31 March 2020 11:46 > To: Shameerali Kolothum Thodi > Cc: qemu-devel@nongnu.org; qemu-arm@nongnu.org; > eric.auger@redhat.com; imammedo@redhat.com; peter.maydell@linaro.org; > xiaoguangrong.eric@gmail.com; david@redhat.com; mst@redhat.com; > Linuxarm ; xuwei (O) ; > shannon.zhaosl@gmail.com; lersek@redhat.com > Subject: Re: [PATCH for-5.0 2/3] fw_cfg: Migrate ACPI table mr sizes sepa= rately [...] > > +static const VMStateDescription vmstate_fw_cfg_acpi_mr =3D { > > + .name =3D "fw_cfg/acpi_mr", > > + .version_id =3D 1, > > + .minimum_version_id =3D 1, > > + .needed =3D fw_cfg_acpi_mr_restore, > > + .post_load =3D fw_cfg_acpi_mr_restore_post_load, > > + .fields =3D (VMStateField[]) { > > + VMSTATE_UINT64(table_mr_size, FWCfgState), > > + VMSTATE_UINT64(linker_mr_size, FWCfgState), > > + VMSTATE_UINT64(rsdp_mr_size, FWCfgState), >=20 > The checker found something I also spotted; which is you can't use a > VMSTATE_UINT64 against a field that is size_t - it's not portable; > I suggest the easiest fix is to make your fields in fw_cfg.h uint64's. Thanks for that. Yes, checker also spotted this and I was clueless. Sure, I= will change that. Shameer > Dave >=20 > > + VMSTATE_END_OF_LIST() > > + }, > > +}; > > + > > static const VMStateDescription vmstate_fw_cfg =3D { > > .name =3D "fw_cfg", > > .version_id =3D 2, > > @@ -631,6 +690,7 @@ static const VMStateDescription vmstate_fw_cfg =3D = { > > }, > > .subsections =3D (const VMStateDescription*[]) { > > &vmstate_fw_cfg_dma, > > + &vmstate_fw_cfg_acpi_mr, > > NULL, > > } > > }; > > @@ -815,6 +875,23 @@ static struct { > > #define FW_CFG_ORDER_OVERRIDE_LAST 200 > > }; > > > > +/* > > + * Any sub-page size update to these table MRs will be lost during mig= ration, > > + * as we use aligned size in ram_load_precopy() -> qemu_ram_resize() p= ath. > > + * In order to avoid the inconsistency in sizes save them seperately a= nd > > + * migrate over in vmstate post_load(). > > + */ > > +static void fw_cfg_acpi_mr_save(FWCfgState *s, const char *filename, > size_t len) > > +{ > > + if (!strcmp(filename, ACPI_BUILD_TABLE_FILE)) { > > + s->table_mr_size =3D len; > > + } else if (!strcmp(filename, ACPI_BUILD_LOADER_FILE)) { > > + s->linker_mr_size =3D len; > > + } else if (!strcmp(filename, ACPI_BUILD_RSDP_FILE)) { > > + s->rsdp_mr_size =3D len; > > + } > > +} > > + > > static int get_fw_cfg_order(FWCfgState *s, const char *name) > > { > > int i; > > @@ -914,6 +991,7 @@ void fw_cfg_add_file_callback(FWCfgState *s, > const char *filename, > > trace_fw_cfg_add_file(s, index, s->files->f[index].name, len); > > > > s->files->count =3D cpu_to_be32(count+1); > > + fw_cfg_acpi_mr_save(s, filename, len); > > } > > > > void fw_cfg_add_file(FWCfgState *s, const char *filename, > > @@ -937,6 +1015,7 @@ void *fw_cfg_modify_file(FWCfgState *s, const char > *filename, > > ptr =3D fw_cfg_modify_bytes_read(s, FW_CFG_FILE_FIRST + i, > > data, len); > > s->files->f[i].size =3D cpu_to_be32(len); > > + fw_cfg_acpi_mr_save(s, filename, len); > > return ptr; > > } > > } > > @@ -973,7 +1052,10 @@ static void fw_cfg_machine_ready(struct Notifier > *n, void *data) > > qemu_register_reset(fw_cfg_machine_reset, s); > > } > > > > - > > +static Property fw_cfg_properties[] =3D { > > + DEFINE_PROP_BOOL("acpi-mr-restore", FWCfgState, acpi_mr_restore, > true), > > + DEFINE_PROP_END_OF_LIST(), > > +}; > > > > static void fw_cfg_common_realize(DeviceState *dev, Error **errp) > > { > > @@ -1097,6 +1179,8 @@ static void fw_cfg_class_init(ObjectClass *klass, > void *data) > > > > dc->reset =3D fw_cfg_reset; > > dc->vmsd =3D &vmstate_fw_cfg; > > + > > + device_class_set_props(dc, fw_cfg_properties); > > } > > > > static const TypeInfo fw_cfg_info =3D { > > diff --git a/include/hw/nvram/fw_cfg.h b/include/hw/nvram/fw_cfg.h > > index b5291eefad..457fee7425 100644 > > --- a/include/hw/nvram/fw_cfg.h > > +++ b/include/hw/nvram/fw_cfg.h > > @@ -53,6 +53,12 @@ struct FWCfgState { > > dma_addr_t dma_addr; > > AddressSpace *dma_as; > > MemoryRegion dma_iomem; > > + > > + /* restore during migration */ > > + bool acpi_mr_restore; > > + size_t table_mr_size; > > + size_t linker_mr_size; > > + size_t rsdp_mr_size; > > }; > > > > struct FWCfgIoState { > > -- > > 2.17.1 > > > > > > > -- > Dr. David Alan Gilbert / dgilbert@redhat.com / Manchester, UK