genode/ports/src/vancouver/disk.h
Markus Partheymueller cbf4a7b0c3 vancouver: Disk support
Vancouver can now assign block devices to guests using the Block
interface. The machine has to be configured to use a specified drive,
which could be theoretically routed to different partitions or services
via policy definitions. Currently the USB driver only supports one
device. Genode's AHCI driver is untested.

If the session quota is too low, random pagefaults can occur on the
stack.

According to @Nils-TUD, it is necessary to protect the DiskCommit
messages with a lock against deadlocking with the timer. Observations
showed that this mitigates some problems with Gentoo on real hardware.
2013-02-13 15:09:23 +01:00

72 lines
1.6 KiB
C++

/*
* \brief Block interface
* \author Markus Partheymueller
* \date 2012-09-15
*/
/*
* Copyright (C) 2012 Intel Corporation
* Copyright (C) 2013 Genode Labs GmbH
*
* This file is part of the Genode OS framework, which is distributed
* under the terms of the GNU General Public License version 2.
*
* The code is partially based on the Vancouver VMM, which is distributed
* under the terms of the GNU General Public License version 2.
*
* Modifications by Intel Corporation are contributed under the terms and
* conditions of the GNU General Public License version 2.
*/
#ifndef _DISK_H_
#define _DISK_H_
/* Genode includes */
#include <base/allocator_avl.h>
#include <base/printf.h>
#include <base/sleep.h>
#include <base/thread.h>
#include <block_session/connection.h>
#include <util/string.h>
/* NOVA userland includes */
#include <nul/motherboard.h>
#include <host/dma.h>
static const bool read_only = false;
class Vancouver_disk : public Genode::Thread<8192>, public StaticReceiver<Vancouver_disk>
{
private:
enum { MAX_DISKS = 16 };
struct {
Block::Connection *blk_con;
Block::Session::Operations ops;
Genode::size_t blk_size;
Genode::size_t blk_cnt;
} _diskcon[MAX_DISKS];
Motherboard &_mb;
char *_backing_store_base;
char *_backing_store_fb_base;
public:
/**
* Constructor
*/
Vancouver_disk(Motherboard &mb,
char * backing_store_base,
char * backing_store_fb_base);
~Vancouver_disk();
void entry();
bool receive(MessageDisk &msg);
};
#endif /* _DISK_H_ */