From patchwork Thu Dec 12 20:40:08 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 22314 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-ve0-f198.google.com (mail-ve0-f198.google.com [209.85.128.198]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 5366C23FC9 for ; Thu, 12 Dec 2013 20:40:14 +0000 (UTC) Received: by mail-ve0-f198.google.com with SMTP id oy12sf2030259veb.9 for ; Thu, 12 Dec 2013 12:40:14 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:delivered-to:from:to:cc:subject :date:message-id:x-original-sender:x-original-authentication-results :precedence:mailing-list:list-id:list-post:list-help:list-archive :list-unsubscribe; bh=B9w074w/fE49vxYI5banzqvqO14s+m6KdzpULj8dFR0=; b=O+ciG37iaedEVlUA9jDMNaEfFt5T8wyANh1myHEyHuj3ILb068p2j7V7nh/lDY8lnJ E7Az+tpHSGSqA+E34rBc6RYWKvvLRDc5VLWjO7U/b5t3Ff+mx4AnR55sf6qkJi5/rEev 8VBE2SE4QIpnjmmFZiXPDuUHd1BFm0Up8Qzmtw3BT95JEgTHqIfWubGhOR6wk1vFGL0j FclrRJZUPecYxCwMrEY8Eu3HxQ/cXmqNiiKyYVTvyjNF0a6UFdThPjSQiMKcg5kEabef +VlTL5UOIb23vFIqNGXepW1H7M4FkL+shFeKvo9GDa49MKalgWf+bGqnhPlYOlVW+QiX Dpcw== X-Gm-Message-State: ALoCoQnmp8LTjMaiSHZo+eaSvM1iHg2UXbaSzLEWs0BCFTXsmX1ufBk9laDW6LJACKKDKqkzwgd4 X-Received: by 10.58.2.98 with SMTP id 2mr3580289vet.3.1386880814687; Thu, 12 Dec 2013 12:40:14 -0800 (PST) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.49.104.76 with SMTP id gc12ls683395qeb.44.gmail; Thu, 12 Dec 2013 12:40:14 -0800 (PST) X-Received: by 10.220.172.129 with SMTP id l1mr372913vcz.75.1386880814519; Thu, 12 Dec 2013 12:40:14 -0800 (PST) Received: from mail-vb0-f51.google.com (mail-vb0-f51.google.com [209.85.212.51]) by mx.google.com with ESMTPS id s5si8069392vev.79.2013.12.12.12.40.14 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Thu, 12 Dec 2013 12:40:14 -0800 (PST) Received-SPF: neutral (google.com: 209.85.212.51 is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) client-ip=209.85.212.51; Received: by mail-vb0-f51.google.com with SMTP id 11so668185vbe.24 for ; Thu, 12 Dec 2013 12:40:14 -0800 (PST) X-Received: by 10.52.36.208 with SMTP id s16mr323759vdj.85.1386880814363; Thu, 12 Dec 2013 12:40:14 -0800 (PST) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patches@linaro.org Received: by 10.220.174.196 with SMTP id u4csp384694vcz; Thu, 12 Dec 2013 12:40:13 -0800 (PST) X-Received: by 10.180.160.210 with SMTP id xm18mr7593155wib.45.1386880813316; Thu, 12 Dec 2013 12:40:13 -0800 (PST) Received: from mnementh.archaic.org.uk (mnementh.archaic.org.uk. [2001:8b0:1d0::1]) by mx.google.com with ESMTPS id bf10si10846081wjc.69.2013.12.12.12.40.12 for (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Thu, 12 Dec 2013 12:40:13 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of pm215@archaic.org.uk designates 2001:8b0:1d0::1 as permitted sender) client-ip=2001:8b0:1d0::1; Received: from pm215 by mnementh.archaic.org.uk with local (Exim 4.80) (envelope-from ) id 1VrD3I-0001U3-GF; Thu, 12 Dec 2013 20:40:08 +0000 From: Peter Maydell To: qemu-devel@nongnu.org Cc: patches@linaro.org, Juan Quintela , Li Guang , Peter Crosthwaite , Stefan Hajnoczi , =?UTF-8?q?Andreas=20F=C3=A4rber?= Subject: [PATCH] vmstate: Add support for an array of ptimer_state * Date: Thu, 12 Dec 2013 20:40:08 +0000 Message-Id: <1386880808-5678-1-git-send-email-peter.maydell@linaro.org> X-Mailer: git-send-email 1.7.10.4 X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: peter.maydell@linaro.org X-Original-Authentication-Results: mx.google.com; spf=neutral (google.com: 209.85.212.51 is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Precedence: list Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org List-ID: X-Google-Group-Id: 836684582541 List-Post: , List-Help: , List-Archive: List-Unsubscribe: , Add support for defining a vmstate field which is an array of pointers to structures, and use this to define a VMSTATE_PTIMER_ARRAY() which allows an array of ptimer_state* to be used by devices. Signed-off-by: Peter Maydell --- This is an odd lacuna in the VMSTATE macros, given that the underlying savevm machinery entirely supports the combination of VMS_ flags. This will be used in the Allwinner A10 timer. include/hw/ptimer.h | 4 ++++ include/migration/vmstate.h | 10 ++++++++++ 2 files changed, 14 insertions(+) diff --git a/include/hw/ptimer.h b/include/hw/ptimer.h index 28fcaf1..a33edf4 100644 --- a/include/hw/ptimer.h +++ b/include/hw/ptimer.h @@ -36,4 +36,8 @@ extern const VMStateDescription vmstate_ptimer; .offset = vmstate_offset_pointer(_state, _field, ptimer_state), \ } +#define VMSTATE_PTIMER_ARRAY(_f, _s, _n) \ + VMSTATE_ARRAY_OF_POINTER_TO_STRUCT(_f, _s, _n, 0, \ + vmstate_ptimer, ptimer_state) + #endif diff --git a/include/migration/vmstate.h b/include/migration/vmstate.h index 9d09e60..be193ba 100644 --- a/include/migration/vmstate.h +++ b/include/migration/vmstate.h @@ -339,6 +339,16 @@ extern const VMStateInfo vmstate_info_bitmap; .offset = vmstate_offset_array(_state, _field, _type, _num), \ } +#define VMSTATE_ARRAY_OF_POINTER_TO_STRUCT(_f, _s, _n, _v, _vmsd, _type) { \ + .name = (stringify(_f)), \ + .version_id = (_v), \ + .num = (_n), \ + .vmsd = &(_vmsd), \ + .size = sizeof(_type *), \ + .flags = VMS_ARRAY|VMS_STRUCT|VMS_ARRAY_OF_POINTER, \ + .offset = vmstate_offset_array(_s, _f, _type*, _n), \ +} + #define VMSTATE_STRUCT_ARRAY_TEST(_field, _state, _num, _test, _version, _vmsd, _type) { \ .name = (stringify(_field)), \ .num = (_num), \