2014-06-02 17:25:05 +04:00
|
|
|
/*
|
|
|
|
* PC DIMM device
|
|
|
|
*
|
|
|
|
* Copyright ProfitBricks GmbH 2012
|
|
|
|
* Copyright (C) 2013-2014 Red Hat Inc
|
|
|
|
*
|
|
|
|
* Authors:
|
|
|
|
* Vasilis Liaskovitis <vasilis.liaskovitis@profitbricks.com>
|
|
|
|
* Igor Mammedov <imammedo@redhat.com>
|
|
|
|
*
|
|
|
|
* This work is licensed under the terms of the GNU GPL, version 2 or later.
|
|
|
|
* See the COPYING file in the top-level directory.
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef QEMU_PC_DIMM_H
|
|
|
|
#define QEMU_PC_DIMM_H
|
|
|
|
|
|
|
|
#include "exec/memory.h"
|
2019-08-12 08:23:51 +03:00
|
|
|
#include "hw/qdev-core.h"
|
2020-09-03 23:43:22 +03:00
|
|
|
#include "qom/object.h"
|
2014-06-02 17:25:05 +04:00
|
|
|
|
|
|
|
#define TYPE_PC_DIMM "pc-dimm"
|
2020-09-01 00:07:37 +03:00
|
|
|
OBJECT_DECLARE_TYPE(PCDIMMDevice, PCDIMMDeviceClass,
|
qom: Remove module_obj_name parameter from OBJECT_DECLARE* macros
One of the goals of having less boilerplate on QOM declarations
is to avoid human error. Requiring an extra argument that is
never used is an opportunity for mistakes.
Remove the unused argument from OBJECT_DECLARE_TYPE and
OBJECT_DECLARE_SIMPLE_TYPE.
Coccinelle patch used to convert all users of the macros:
@@
declarer name OBJECT_DECLARE_TYPE;
identifier InstanceType, ClassType, lowercase, UPPERCASE;
@@
OBJECT_DECLARE_TYPE(InstanceType, ClassType,
- lowercase,
UPPERCASE);
@@
declarer name OBJECT_DECLARE_SIMPLE_TYPE;
identifier InstanceType, lowercase, UPPERCASE;
@@
OBJECT_DECLARE_SIMPLE_TYPE(InstanceType,
- lowercase,
UPPERCASE);
Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
Reviewed-by: Cédric Le Goater <clg@kaod.org>
Acked-by: Cornelia Huck <cohuck@redhat.com>
Acked-by: Igor Mammedov <imammedo@redhat.com>
Acked-by: Paul Durrant <paul@xen.org>
Acked-by: Thomas Huth <thuth@redhat.com>
Message-Id: <20200916182519.415636-4-ehabkost@redhat.com>
Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
2020-09-16 21:25:17 +03:00
|
|
|
PC_DIMM)
|
2014-06-02 17:25:05 +04:00
|
|
|
|
|
|
|
#define PC_DIMM_ADDR_PROP "addr"
|
|
|
|
#define PC_DIMM_SLOT_PROP "slot"
|
|
|
|
#define PC_DIMM_NODE_PROP "node"
|
|
|
|
#define PC_DIMM_SIZE_PROP "size"
|
|
|
|
#define PC_DIMM_MEMDEV_PROP "memdev"
|
|
|
|
|
|
|
|
#define PC_DIMM_UNASSIGNED_SLOT -1
|
|
|
|
|
|
|
|
/**
|
|
|
|
* PCDIMMDevice:
|
|
|
|
* @addr: starting guest physical address, where @PCDIMMDevice is mapped.
|
|
|
|
* Default value: 0, means that address is auto-allocated.
|
|
|
|
* @node: numa node to which @PCDIMMDevice is attached.
|
|
|
|
* @slot: slot number into which @PCDIMMDevice is plugged in.
|
|
|
|
* Default value: -1, means that slot is auto-allocated.
|
|
|
|
* @hostmem: host memory backend providing memory for @PCDIMMDevice
|
|
|
|
*/
|
2020-09-03 23:43:22 +03:00
|
|
|
struct PCDIMMDevice {
|
2014-06-02 17:25:05 +04:00
|
|
|
/* private */
|
|
|
|
DeviceState parent_obj;
|
|
|
|
|
|
|
|
/* public */
|
|
|
|
uint64_t addr;
|
|
|
|
uint32_t node;
|
|
|
|
int32_t slot;
|
|
|
|
HostMemoryBackend *hostmem;
|
2020-09-03 23:43:22 +03:00
|
|
|
};
|
2014-06-02 17:25:05 +04:00
|
|
|
|
|
|
|
/**
|
|
|
|
* PCDIMMDeviceClass:
|
2016-05-20 11:19:59 +03:00
|
|
|
* @realize: called after common dimm is realized so that the dimm based
|
|
|
|
* devices get the chance to do specified operations.
|
2014-06-02 17:25:05 +04:00
|
|
|
*/
|
2020-09-03 23:43:22 +03:00
|
|
|
struct PCDIMMDeviceClass {
|
2014-06-02 17:25:05 +04:00
|
|
|
/* private */
|
|
|
|
DeviceClass parent_class;
|
|
|
|
|
|
|
|
/* public */
|
2016-05-20 11:19:59 +03:00
|
|
|
void (*realize)(PCDIMMDevice *dimm, Error **errp);
|
2022-02-18 10:34:13 +03:00
|
|
|
void (*unrealize)(PCDIMMDevice *dimm);
|
2020-09-03 23:43:22 +03:00
|
|
|
};
|
2014-06-02 17:25:05 +04:00
|
|
|
|
2024-02-28 12:26:33 +03:00
|
|
|
void pc_dimm_pre_plug(PCDIMMDevice *dimm, MachineState *machine, Error **errp);
|
2020-10-19 11:48:04 +03:00
|
|
|
void pc_dimm_plug(PCDIMMDevice *dimm, MachineState *machine);
|
2018-10-05 12:20:12 +03:00
|
|
|
void pc_dimm_unplug(PCDIMMDevice *dimm, MachineState *machine);
|
2014-06-02 17:25:05 +04:00
|
|
|
#endif
|