VM: remove unused dma memory support functions from vm
. unused calls / data structures
This commit is contained in:
parent
8821c73a9e
commit
2cb560297c
@ -55,13 +55,15 @@ static void init_domain(int index);
|
|||||||
static void init_map(unsigned int ix);
|
static void init_map(unsigned int ix);
|
||||||
static int do_add4pci(const message *m);
|
static int do_add4pci(const message *m);
|
||||||
static void add_range(phys_bytes busaddr, phys_bytes size);
|
static void add_range(phys_bytes busaddr, phys_bytes size);
|
||||||
|
#if 0
|
||||||
static void del_range(phys_bytes busaddr, phys_bytes size);
|
static void del_range(phys_bytes busaddr, phys_bytes size);
|
||||||
|
static void sef_cb_signal_handler(int signo);
|
||||||
|
#endif
|
||||||
static void report_exceptions(void);
|
static void report_exceptions(void);
|
||||||
|
|
||||||
/* SEF functions and variables. */
|
/* SEF functions and variables. */
|
||||||
static void sef_local_startup(void);
|
static void sef_local_startup(void);
|
||||||
static int sef_cb_init_fresh(int type, sef_init_info_t *info);
|
static int sef_cb_init_fresh(int type, sef_init_info_t *info);
|
||||||
static void sef_cb_signal_handler(int signo);
|
|
||||||
|
|
||||||
int main(void)
|
int main(void)
|
||||||
{
|
{
|
||||||
@ -103,8 +105,10 @@ static void sef_local_startup()
|
|||||||
sef_setcb_lu_prepare(sef_cb_lu_prepare_always_ready);
|
sef_setcb_lu_prepare(sef_cb_lu_prepare_always_ready);
|
||||||
sef_setcb_lu_state_isvalid(sef_cb_lu_state_isvalid_standard);
|
sef_setcb_lu_state_isvalid(sef_cb_lu_state_isvalid_standard);
|
||||||
|
|
||||||
|
#if 0
|
||||||
/* Register signal callbacks. */
|
/* Register signal callbacks. */
|
||||||
sef_setcb_signal_handler(sef_cb_signal_handler);
|
sef_setcb_signal_handler(sef_cb_signal_handler);
|
||||||
|
#endif
|
||||||
|
|
||||||
/* Let SEF perform startup. */
|
/* Let SEF perform startup. */
|
||||||
sef_startup();
|
sef_startup();
|
||||||
@ -154,6 +158,7 @@ static int sef_cb_init_fresh(int UNUSED(type), sef_init_info_t *UNUSED(info))
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
#if 0
|
||||||
/*===========================================================================*
|
/*===========================================================================*
|
||||||
* sef_cb_signal_handler *
|
* sef_cb_signal_handler *
|
||||||
*===========================================================================*/
|
*===========================================================================*/
|
||||||
@ -193,6 +198,7 @@ static void sef_cb_signal_handler(int signo)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
/* Returns 0 if no device found, or 1 if a device is found. */
|
/* Returns 0 if no device found, or 1 if a device is found. */
|
||||||
static int find_dev(devindp, capaddrp)
|
static int find_dev(devindp, capaddrp)
|
||||||
@ -411,6 +417,7 @@ static int do_add4pci(const message *m)
|
|||||||
return r;
|
return r;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if 0
|
||||||
r= vm_adddma(proc, start, size);
|
r= vm_adddma(proc, start, size);
|
||||||
if (r != 0)
|
if (r != 0)
|
||||||
{
|
{
|
||||||
@ -419,6 +426,7 @@ static int do_add4pci(const message *m)
|
|||||||
"proc %d: %d\n", size, start, proc, r);
|
"proc %d: %d\n", size, start, proc, r);
|
||||||
return r;
|
return r;
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
add_range(busaddr, size);
|
add_range(busaddr, size);
|
||||||
|
|
||||||
@ -441,6 +449,7 @@ static void add_range(phys_bytes busaddr, phys_bytes size)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if 0
|
||||||
static void del_range(phys_bytes busaddr, phys_bytes size)
|
static void del_range(phys_bytes busaddr, phys_bytes size)
|
||||||
{
|
{
|
||||||
phys_bytes o;
|
phys_bytes o;
|
||||||
@ -455,6 +464,7 @@ static void del_range(phys_bytes busaddr, phys_bytes size)
|
|||||||
table[bit/8] |= (1 << (bit % 8));
|
table[bit/8] |= (1 << (bit % 8));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
static void report_exceptions(void)
|
static void report_exceptions(void)
|
||||||
{
|
{
|
||||||
|
@ -76,7 +76,6 @@ SRCS= \
|
|||||||
tickdelay.c \
|
tickdelay.c \
|
||||||
timers.c \
|
timers.c \
|
||||||
vm_brk.c \
|
vm_brk.c \
|
||||||
vm_dmacalls.c \
|
|
||||||
vm_exit.c \
|
vm_exit.c \
|
||||||
vm_fork.c \
|
vm_fork.c \
|
||||||
vm_info.c \
|
vm_info.c \
|
||||||
|
@ -1,52 +0,0 @@
|
|||||||
|
|
||||||
#include <lib.h>
|
|
||||||
#include <minix/vm.h>
|
|
||||||
#include <unistd.h>
|
|
||||||
#include <stdarg.h>
|
|
||||||
|
|
||||||
int vm_adddma(proc_e, start, size)
|
|
||||||
endpoint_t proc_e;
|
|
||||||
phys_bytes start;
|
|
||||||
phys_bytes size;
|
|
||||||
{
|
|
||||||
message m;
|
|
||||||
|
|
||||||
m.VMAD_EP= proc_e;
|
|
||||||
m.VMAD_START= start;
|
|
||||||
m.VMAD_SIZE= size;
|
|
||||||
|
|
||||||
return _syscall(VM_PROC_NR, VM_ADDDMA, &m);
|
|
||||||
}
|
|
||||||
|
|
||||||
int vm_deldma(proc_e, start, size)
|
|
||||||
endpoint_t proc_e;
|
|
||||||
phys_bytes start;
|
|
||||||
phys_bytes size;
|
|
||||||
{
|
|
||||||
message m;
|
|
||||||
|
|
||||||
m.VMDD_EP= proc_e;
|
|
||||||
m.VMDD_START= start;
|
|
||||||
m.VMDD_SIZE= size;
|
|
||||||
|
|
||||||
return _syscall(VM_PROC_NR, VM_DELDMA, &m);
|
|
||||||
}
|
|
||||||
|
|
||||||
int vm_getdma(procp, basep, sizep)
|
|
||||||
endpoint_t *procp;
|
|
||||||
phys_bytes *basep;
|
|
||||||
phys_bytes *sizep;
|
|
||||||
{
|
|
||||||
int r;
|
|
||||||
message m;
|
|
||||||
|
|
||||||
r= _syscall(VM_PROC_NR, VM_GETDMA, &m);
|
|
||||||
if (r == 0)
|
|
||||||
{
|
|
||||||
*procp= m.VMGD_PROCP;
|
|
||||||
*basep= m.VMGD_BASEP;
|
|
||||||
*sizep= m.VMGD_SIZEP;
|
|
||||||
}
|
|
||||||
return r;
|
|
||||||
}
|
|
||||||
|
|
@ -381,195 +381,6 @@ static void free_pages(phys_bytes pageno, int npages)
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
#define NR_DMA 16
|
|
||||||
|
|
||||||
static struct dmatab
|
|
||||||
{
|
|
||||||
int dt_flags;
|
|
||||||
endpoint_t dt_proc;
|
|
||||||
phys_bytes dt_base;
|
|
||||||
phys_bytes dt_size;
|
|
||||||
phys_clicks dt_seg_base;
|
|
||||||
phys_clicks dt_seg_size;
|
|
||||||
} dmatab[NR_DMA];
|
|
||||||
|
|
||||||
#define DTF_INUSE 1
|
|
||||||
#define DTF_RELEASE_DMA 2
|
|
||||||
#define DTF_RELEASE_SEG 4
|
|
||||||
|
|
||||||
/*===========================================================================*
|
|
||||||
* do_adddma *
|
|
||||||
*===========================================================================*/
|
|
||||||
int do_adddma(message *msg)
|
|
||||||
{
|
|
||||||
endpoint_t target_proc_e;
|
|
||||||
int i, proc_n;
|
|
||||||
phys_bytes base, size;
|
|
||||||
struct vmproc *vmp;
|
|
||||||
|
|
||||||
target_proc_e= msg->VMAD_EP;
|
|
||||||
base= msg->VMAD_START;
|
|
||||||
size= msg->VMAD_SIZE;
|
|
||||||
|
|
||||||
/* Find empty slot */
|
|
||||||
for (i= 0; i<NR_DMA; i++)
|
|
||||||
{
|
|
||||||
if (!(dmatab[i].dt_flags & DTF_INUSE))
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
if (i >= NR_DMA)
|
|
||||||
{
|
|
||||||
printf("vm:do_adddma: dma table full\n");
|
|
||||||
for (i= 0; i<NR_DMA; i++)
|
|
||||||
{
|
|
||||||
printf("%d: flags 0x%x proc %d base 0x%lx size 0x%lx\n",
|
|
||||||
i, dmatab[i].dt_flags,
|
|
||||||
dmatab[i].dt_proc,
|
|
||||||
dmatab[i].dt_base,
|
|
||||||
dmatab[i].dt_size);
|
|
||||||
}
|
|
||||||
panic("adddma: table full");
|
|
||||||
return ENOSPC;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Find target process */
|
|
||||||
if (vm_isokendpt(target_proc_e, &proc_n) != OK)
|
|
||||||
{
|
|
||||||
printf("vm:do_adddma: endpoint %d not found\n", target_proc_e);
|
|
||||||
return EINVAL;
|
|
||||||
}
|
|
||||||
vmp= &vmproc[proc_n];
|
|
||||||
vmp->vm_flags |= VMF_HAS_DMA;
|
|
||||||
|
|
||||||
dmatab[i].dt_flags= DTF_INUSE;
|
|
||||||
dmatab[i].dt_proc= target_proc_e;
|
|
||||||
dmatab[i].dt_base= base;
|
|
||||||
dmatab[i].dt_size= size;
|
|
||||||
|
|
||||||
return OK;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*===========================================================================*
|
|
||||||
* do_deldma *
|
|
||||||
*===========================================================================*/
|
|
||||||
int do_deldma(message *msg)
|
|
||||||
{
|
|
||||||
endpoint_t target_proc_e;
|
|
||||||
int i, j;
|
|
||||||
phys_bytes base, size;
|
|
||||||
|
|
||||||
target_proc_e= msg->VMDD_EP;
|
|
||||||
base= msg->VMDD_START;
|
|
||||||
size= msg->VMDD_SIZE;
|
|
||||||
|
|
||||||
/* Find slot */
|
|
||||||
for (i= 0; i<NR_DMA; i++)
|
|
||||||
{
|
|
||||||
if (!(dmatab[i].dt_flags & DTF_INUSE))
|
|
||||||
continue;
|
|
||||||
if (dmatab[i].dt_proc == target_proc_e &&
|
|
||||||
dmatab[i].dt_base == base &&
|
|
||||||
dmatab[i].dt_size == size)
|
|
||||||
{
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (i >= NR_DMA)
|
|
||||||
{
|
|
||||||
printf("vm:do_deldma: slot not found\n");
|
|
||||||
return ESRCH;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (dmatab[i].dt_flags & DTF_RELEASE_SEG)
|
|
||||||
{
|
|
||||||
/* Check if we have to release the segment */
|
|
||||||
for (j= 0; j<NR_DMA; j++)
|
|
||||||
{
|
|
||||||
if (j == i)
|
|
||||||
continue;
|
|
||||||
if (!(dmatab[j].dt_flags & DTF_INUSE))
|
|
||||||
continue;
|
|
||||||
if (!(dmatab[j].dt_flags & DTF_RELEASE_SEG))
|
|
||||||
continue;
|
|
||||||
if (dmatab[i].dt_proc == target_proc_e)
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
if (j >= NR_DMA)
|
|
||||||
{
|
|
||||||
/* Last segment */
|
|
||||||
free_mem(dmatab[i].dt_seg_base,
|
|
||||||
dmatab[i].dt_seg_size);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
dmatab[i].dt_flags &= ~DTF_INUSE;
|
|
||||||
|
|
||||||
return OK;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*===========================================================================*
|
|
||||||
* do_getdma *
|
|
||||||
*===========================================================================*/
|
|
||||||
int do_getdma(message *msg)
|
|
||||||
{
|
|
||||||
int i;
|
|
||||||
|
|
||||||
/* Find slot to report */
|
|
||||||
for (i= 0; i<NR_DMA; i++)
|
|
||||||
{
|
|
||||||
if (!(dmatab[i].dt_flags & DTF_INUSE))
|
|
||||||
continue;
|
|
||||||
if (!(dmatab[i].dt_flags & DTF_RELEASE_DMA))
|
|
||||||
continue;
|
|
||||||
|
|
||||||
printf("do_getdma: setting reply to 0x%lx@0x%lx proc %d\n",
|
|
||||||
dmatab[i].dt_size, dmatab[i].dt_base,
|
|
||||||
dmatab[i].dt_proc);
|
|
||||||
msg->VMGD_PROCP= dmatab[i].dt_proc;
|
|
||||||
msg->VMGD_BASEP= dmatab[i].dt_base;
|
|
||||||
msg->VMGD_SIZEP= dmatab[i].dt_size;
|
|
||||||
|
|
||||||
return OK;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Nothing */
|
|
||||||
return EAGAIN;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/*===========================================================================*
|
|
||||||
* release_dma *
|
|
||||||
*===========================================================================*/
|
|
||||||
void release_dma(struct vmproc *vmp)
|
|
||||||
{
|
|
||||||
#if 0
|
|
||||||
int i, found_one;
|
|
||||||
|
|
||||||
found_one= FALSE;
|
|
||||||
for (i= 0; i<NR_DMA; i++)
|
|
||||||
{
|
|
||||||
if (!(dmatab[i].dt_flags & DTF_INUSE))
|
|
||||||
continue;
|
|
||||||
if (dmatab[i].dt_proc != vmp->vm_endpoint)
|
|
||||||
continue;
|
|
||||||
dmatab[i].dt_flags |= DTF_RELEASE_DMA | DTF_RELEASE_SEG;
|
|
||||||
dmatab[i].dt_seg_base= base;
|
|
||||||
dmatab[i].dt_seg_size= size;
|
|
||||||
found_one= TRUE;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!found_one)
|
|
||||||
free_mem(base, size);
|
|
||||||
|
|
||||||
msg->VMRD_FOUND = found_one;
|
|
||||||
#else
|
|
||||||
panic("release_dma not done");
|
|
||||||
#endif
|
|
||||||
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*===========================================================================*
|
/*===========================================================================*
|
||||||
* printmemstats *
|
* printmemstats *
|
||||||
*===========================================================================*/
|
*===========================================================================*/
|
||||||
|
@ -67,9 +67,7 @@ SANITYCHECK(SCL_FUNCTIONS);
|
|||||||
return EINVAL;
|
return EINVAL;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(vmp->vm_flags & VMF_HAS_DMA) {
|
{
|
||||||
release_dma(vmp);
|
|
||||||
} else {
|
|
||||||
/* Free pagetable and pages allocated by pt code. */
|
/* Free pagetable and pages allocated by pt code. */
|
||||||
SANITYCHECK(SCL_DETAIL);
|
SANITYCHECK(SCL_DETAIL);
|
||||||
free_proc(vmp);
|
free_proc(vmp);
|
||||||
|
@ -58,11 +58,6 @@ int do_fork(message *msg)
|
|||||||
vmc = &vmproc[childproc]; /* child */
|
vmc = &vmproc[childproc]; /* child */
|
||||||
assert(vmc->vm_slot == childproc);
|
assert(vmc->vm_slot == childproc);
|
||||||
|
|
||||||
if(vmp->vm_flags & VMF_HAS_DMA) {
|
|
||||||
printf("VM: %d has DMA memory and may not fork\n", msg->VMF_ENDPOINT);
|
|
||||||
return EINVAL;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* The child is basically a copy of the parent. */
|
/* The child is basically a copy of the parent. */
|
||||||
origpt = vmc->vm_pt;
|
origpt = vmc->vm_pt;
|
||||||
*vmc = *vmp;
|
*vmc = *vmp;
|
||||||
|
@ -391,9 +391,6 @@ void init_vm(void)
|
|||||||
CALLMAP(VM_FORK, do_fork);
|
CALLMAP(VM_FORK, do_fork);
|
||||||
CALLMAP(VM_BRK, do_brk);
|
CALLMAP(VM_BRK, do_brk);
|
||||||
CALLMAP(VM_WILLEXIT, do_willexit);
|
CALLMAP(VM_WILLEXIT, do_willexit);
|
||||||
CALLMAP(VM_ADDDMA, do_adddma);
|
|
||||||
CALLMAP(VM_DELDMA, do_deldma);
|
|
||||||
CALLMAP(VM_GETDMA, do_getdma);
|
|
||||||
CALLMAP(VM_NOTIFY_SIG, do_notify_sig);
|
CALLMAP(VM_NOTIFY_SIG, do_notify_sig);
|
||||||
|
|
||||||
/* Calls from RS */
|
/* Calls from RS */
|
||||||
|
@ -21,10 +21,6 @@ struct phys_region;
|
|||||||
void mem_sanitycheck(char *file, int line);
|
void mem_sanitycheck(char *file, int line);
|
||||||
phys_clicks alloc_mem(phys_clicks clicks, u32_t flags);
|
phys_clicks alloc_mem(phys_clicks clicks, u32_t flags);
|
||||||
struct memlist *alloc_mem_in_list(phys_bytes bytes, u32_t flags);
|
struct memlist *alloc_mem_in_list(phys_bytes bytes, u32_t flags);
|
||||||
int do_adddma(message *msg);
|
|
||||||
int do_deldma(message *msg);
|
|
||||||
int do_getdma(message *msg);
|
|
||||||
void release_dma(struct vmproc *vmp);
|
|
||||||
void memstats(int *nodes, int *pages, int *largest);
|
void memstats(int *nodes, int *pages, int *largest);
|
||||||
void printmemstats(void);
|
void printmemstats(void);
|
||||||
void usedpages_reset(void);
|
void usedpages_reset(void);
|
||||||
|
@ -49,9 +49,6 @@ struct vmproc {
|
|||||||
/* Bits for vm_flags */
|
/* Bits for vm_flags */
|
||||||
#define VMF_INUSE 0x001 /* slot contains a process */
|
#define VMF_INUSE 0x001 /* slot contains a process */
|
||||||
#define VMF_EXITING 0x002 /* PM is cleaning up this process */
|
#define VMF_EXITING 0x002 /* PM is cleaning up this process */
|
||||||
#define VMF_HAS_DMA 0x004 /* Process directly or indirectly granted
|
|
||||||
* DMA buffers.
|
|
||||||
*/
|
|
||||||
#define VMF_WATCHEXIT 0x008 /* Store in queryexit table */
|
#define VMF_WATCHEXIT 0x008 /* Store in queryexit table */
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
Loading…
x
Reference in New Issue
Block a user