Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
View | Details | Raw Unified | Return to bug 235231
Collapse All | Expand All

(-)NVIDIA-Linux-x86_64-177.13-pkg2/usr/src/nv/Makefile.kbuild (-3 / +8 lines)
Lines 63-69 Link Here
63
# set this conditional of a kernel-level instance.
63
# set this conditional of a kernel-level instance.
64
#
64
#
65
ifdef TOPDIR
65
ifdef srctree
66
obj-m := $(MODULE_NAME).o
66
obj-m := $(MODULE_NAME).o
67
endif
67
endif
Lines 75-80 Link Here
75
EXTRA_CFLAGS += -I$(src)
75
EXTRA_CFLAGS += -I$(src)
76
EXTRA_CFLAGS += -Wall -Wimplicit -Wreturn-type -Wswitch -Wformat -Wchar-subscripts -Wparentheses -Wpointer-arith -Wno-multichar -Werror -mcmodel=kernel -mno-red-zone -MD $(DEFINES) $(INCLUDES) -Wsign-compare -Wno-cast-qual -Wno-error
76
EXTRA_CFLAGS += -Wall -Wimplicit -Wreturn-type -Wswitch -Wformat -Wchar-subscripts -Wparentheses -Wpointer-arith -Wno-multichar -Werror -mcmodel=kernel -mno-red-zone -MD $(DEFINES) $(INCLUDES) -Wsign-compare -Wno-cast-qual -Wno-error
77
PV_CPU := $(shell grep "D pv_cpu_ops" /boot/System.map-$(shell uname -r) | colrm 9)
78
PV_LOCK := $(shell grep "D pv_lock_ops" /boot/System.map-$(shell uname -r) | colrm 9)
79
EXTRA_LDFLAGS :=
80
77
#
81
#
78
# We rely on these two definitions below; if they aren't set, we set them to
82
# We rely on these two definitions below; if they aren't set, we set them to
79
# reasonable defaults (Linux 2.4's KBUILD, and top-level passes will not set
83
# reasonable defaults (Linux 2.4's KBUILD, and top-level passes will not set
Lines 129-135 Link Here
129
# a top-level run).
133
# a top-level run).
130
#
134
#
131
TOPDIR ?= $(KERNEL_SOURCES)
135
srctree ?= $(KERNEL_SOURCES)
132
PATCHLEVEL ?= $(shell $(CONFTEST) kernel_patch_level)
136
PATCHLEVEL ?= $(shell $(CONFTEST) kernel_patch_level)
133
#
137
#
Lines 186-192 Link Here
186
	acpi_device_ops \
190
	acpi_device_ops \
187
	acpi_device_id \
191
	acpi_device_id \
188
	acquire_console_sem \
192
	acquire_console_sem \
189
	kmem_cache_create
193
	kmem_cache_create \
194
	on_each_cpu
190
else
195
else
191
 COMPILE_TESTS = \
196
 COMPILE_TESTS = \
192
	remap_page_range \
197
	remap_page_range \
(-)NVIDIA-Linux-x86_64-177.13-pkg2/usr/src/nv/conftest.sh (-1 / +58 lines)
Lines 32-38 Link Here
32
        #
32
        #
33
        echo "#include <linux/autoconf.h>
33
        echo "#include <linux/autoconf.h>
34
        #ifdef CONFIG_XEN
34
        #ifdef CONFIG_XEN
35
        #error CONFIG_XEN defined!
35
        /*#error CONFIG_XEN defined!*/
36
        #endif
36
        #endif
37
        " > conftest$$.c
37
        " > conftest$$.c
Lines 51-56 Link Here
51
            fi
51
            fi
52
        fi
52
        fi
53
    fi
53
    fi
54
55
    XEN_PRESENT=0
54
}
56
}
55
build_cflags() {
57
build_cflags() {
Lines 774-779 Link Here
774
            fi
776
            fi
775
        ;;
777
        ;;
778
        on_each_cpu)
779
            #
780
            # Determine if the on_each_cpu() function is
781
            # present and how many arguments it takes.
782
            #
783
            echo "$CONFTEST_PREAMBLE
784
            #include <linux/smp.h>
785
            int conftest_on_each_cpu(void) {
786
                return on_each_cpu();
787
            }" > conftest$$.c
788
789
            $CC $CFLAGS -c conftest$$.c > /dev/null 2>&1
790
            rm -f conftest$$.c
791
792
            if [ -f conftest$$.o ]; then
793
                rm -f conftest$$.o
794
                echo "#undef NV_ON_EACH_CPU_PRESENT" >> conftest.h
795
                return
796
            fi
797
798
            echo "$CONFTEST_PREAMBLE
799
            #include <linux/smp.h>
800
            int conftest_on_each_cpu(void (*func) (void *info), void *info) {
801
                return on_each_cpu(func, info, 0, 0);
802
            }" > conftest$$.c
803
804
            $CC $CFLAGS -c conftest$$.c > /dev/null 2>&1
805
            rm -f conftest$$.c
806
807
            if [ -f conftest$$.o ]; then
808
                rm -f conftest$$.o
809
                echo "#define NV_ON_EACH_CPU_PRESENT" >> conftest.h
810
                echo "#define NV_ON_EACH_CPU_ARGUMENT_COUNT 4 " >> conftest.h
811
                return
812
            fi
813
814
            echo "$CONFTEST_PREAMBLE
815
            #include <linux/smp.h>
816
            int conftest_on_each_cpu(void (*func) (void *info), void *info) {
817
                return on_each_cpu(func, info, 0);
818
            }" > conftest$$.c
819
820
            $CC $CFLAGS -c conftest$$.c > /dev/null 2>&1
821
            rm -f conftest$$.c
822
823
            if [ -f conftest$$.o ]; then
824
                rm -f conftest$$.o
825
                echo "#define NV_ON_EACH_CPU_PRESENT" >> conftest.h
826
                echo "#define NV_ON_EACH_CPU_ARGUMENT_COUNT 3 " >> conftest.h
827
                return
828
            else
829
                echo "#error on_each_cpu() conftest failed!" >> conftest.h
830
            fi
831
        ;;
832
776
    esac
833
    esac
777
}
834
}
(-)NVIDIA-Linux-x86_64-177.13-pkg2/usr/src/nv/nv-linux.h (-14 / +19 lines)
Lines 104-118 Link Here
104
#endif
104
#endif
105
#include <linux/spinlock.h>
105
#include <linux/spinlock.h>
106
#include <asm/semaphore.h>
106
#include <linux/semaphore.h>
107
#include <linux/completion.h>
107
#include <linux/completion.h>
108
#include <linux/highmem.h>
108
#include <linux/highmem.h>
109
#ifdef CONFIG_XEN
110
#include <asm/maddr.h>
111
#include <xen/interface/memory.h>
112
#endif
113
114
#ifdef CONFIG_PROC_FS
109
#ifdef CONFIG_PROC_FS
115
#include <linux/proc_fs.h>
110
#include <linux/proc_fs.h>
116
#endif
111
#endif
Lines 144-150 Link Here
144
#include <linux/agpgart.h>
139
#include <linux/agpgart.h>
145
#endif
140
#endif
146
#if (defined(NVCPU_X86) || defined(NVCPU_X86_64)) && !defined(CONFIG_XEN)
141
#if (defined(NVCPU_X86) || defined(NVCPU_X86_64))
147
#define NV_ENABLE_PAT_SUPPORT
142
#define NV_ENABLE_PAT_SUPPORT
148
#endif
143
#endif
Lines 656-661 Link Here
656
#endif /* !defined NVWATCH */
651
#endif /* !defined NVWATCH */
652
#if defined(NV_ON_EACH_CPU_PRESENT)
653
#if (NV_ON_EACH_CPU_ARGUMENT_COUNT == 4)
654
#define NV_ON_EACH_CPU(func, info, retry, wait) on_each_cpu(func, info, retry, wait)
655
#define NV_SMP_CALL_FUNCTION(func, info, retry, wait) smp_call_function(func, info, retry, wait)
656
#elif (NV_ON_EACH_CPU_ARGUMENT_COUNT == 3)
657
#define NV_ON_EACH_CPU(func, info, retry, wait) on_each_cpu(func, info, wait)
658
#define NV_SMP_CALL_FUNCTION(func, info, retry, wait) smp_call_function(func, info, wait)
659
#else
660
#error "NV_ON_EACH_CPU_ARGUMENT_COUNT value unrecognized!"
661
#endif
662
#else
663
#error "NV_ON_EACH_CPU() undefined (on_each_cpu() unavailable)!"
664
#endif
665
657
static inline int nv_execute_on_all_cpus(void (*func)(void *info), void *info)
666
static inline int nv_execute_on_all_cpus(void (*func)(void *info), void *info)
658
{
667
{
659
    int ret = 0;
668
    int ret = 0;
Lines 665-677 Link Here
665
#if defined(preempt_disable)
674
#if defined(preempt_disable)
666
    preempt_disable();
675
    preempt_disable();
667
#endif
676
#endif
668
    ret = smp_call_function(func, info, 1, 1);
677
    ret = NV_SMP_CALL_FUNCTION(func, info, 1, 1);
669
    func(info);
678
    func(info);
670
#if defined(preempt_enable)
679
#if defined(preempt_enable)
671
    preempt_enable();
680
    preempt_enable();
672
#endif
681
#endif
673
#else
682
#else
674
    ret = on_each_cpu(func, info, 1, 1);
683
    ret = NV_ON_EACH_CPU(func, info, 1, 1);
675
#endif
684
#endif
676
    return ret;
685
    return ret;
677
}
686
}
Lines 727-737 Link Here
727
#define NV_TASK_STRUCT_RLIM(current)  ((current)->rlim)
736
#define NV_TASK_STRUCT_RLIM(current)  ((current)->rlim)
728
#endif
737
#endif
729
#ifdef CONFIG_XEN
730
#define NV_GET_DMA_ADDRESS(phys_addr) phys_to_machine(phys_addr)
731
#else
732
#define NV_GET_DMA_ADDRESS(phys_addr) (phys_addr)
738
#define NV_GET_DMA_ADDRESS(phys_addr) (phys_addr)
733
#endif
734
#define NV_GET_PAGE_STRUCT(phys_page) virt_to_page(__va(phys_page))
739
#define NV_GET_PAGE_STRUCT(phys_page) virt_to_page(__va(phys_page))
735
#define NV_VMA_PGOFF(vma)             ((vma)->vm_pgoff)
740
#define NV_VMA_PGOFF(vma)             ((vma)->vm_pgoff)
Lines 884-890 Link Here
884
#else
889
#else
885
#error "NV_REMAP_PAGE_RANGE() undefined!"
890
#error "NV_REMAP_PAGE_RANGE() undefined!"
886
#endif
891
#endif
887
#if !defined(CONFIG_XEN)
892
#if 1
888
#define NV_IO_REMAP_PAGE_RANGE(from, offset, x...) \
893
#define NV_IO_REMAP_PAGE_RANGE(from, offset, x...) \
889
    NV_REMAP_PAGE_RANGE(from, offset, x)
894
    NV_REMAP_PAGE_RANGE(from, offset, x)
890
#else
895
#else
(-)NVIDIA-Linux-x86_64-177.13-pkg2/usr/src/nv/nv-vm.c (-1 / +1 lines)
Lines 312-318 Link Here
312
#endif
312
#endif
313
#if (defined(KERNEL_2_4) || defined(NV_CPA_DF_LIST_BUG) || \
313
#if (defined(KERNEL_2_4) || defined(NV_CPA_DF_LIST_BUG) || \
314
  (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 20))) && !defined(CONFIG_XEN)
314
  (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 20)))
315
#define NV_CPA_NEEDS_FLUSHING 1
315
#define NV_CPA_NEEDS_FLUSHING 1
316
#endif
316
#endif
(-)NVIDIA-Linux-x86_64-177.13-pkg2/usr/src/nv/nv.c (-28 / +3 lines)
Lines 1296-1309 Link Here
1296
            if (get_cpu() == cpu)
1296
            if (get_cpu() == cpu)
1297
                __nv_setup_pat_entries(NULL);
1297
                __nv_setup_pat_entries(NULL);
1298
            else
1298
            else
1299
                smp_call_function(__nv_setup_pat_entries, hcpu, 1, 1);
1299
                NV_SMP_CALL_FUNCTION(__nv_setup_pat_entries, hcpu, 1, 1);
1300
            put_cpu();
1300
            put_cpu();
1301
            break;
1301
            break;
1302
        case CPU_DOWN_PREPARE:
1302
        case CPU_DOWN_PREPARE:
1303
            if (get_cpu() == cpu)
1303
            if (get_cpu() == cpu)
1304
                __nv_restore_pat_entries(NULL);
1304
                __nv_restore_pat_entries(NULL);
1305
            else
1305
            else
1306
                smp_call_function(__nv_restore_pat_entries, hcpu, 1, 1);
1306
                NV_SMP_CALL_FUNCTION(__nv_restore_pat_entries, hcpu, 1, 1);
1307
            put_cpu();
1307
            put_cpu();
1308
            break;
1308
            break;
1309
    }
1309
    }
Lines 2040-2056 Link Here
2040
            goto failed;
2040
            goto failed;
2041
        }
2041
        }
2042
#if defined(CONFIG_XEN) && defined(NVCPU_X86)
2043
        if (HYPERVISOR_memory_op(XENMEM_maximum_ram_page, NULL) > 0xfffff)
2044
        {
2045
            nv_printf(NV_DBG_ERRORS,
2046
                "NVRM: Systems with system memory mapped above the 4GB boundary\n"
2047
                "NVRM: are not supported when using x86 Xen kernels.\n");
2048
            rc = -EIO;
2049
            goto failed;
2050
        }
2051
#endif
2052
2053
        if (!rm_init_adapter(sp, nv))
2042
        if (!rm_init_adapter(sp, nv))
2054
        {
2043
        {
2055
            free_irq(nv->interrupt_line, (void *) nvl);
2044
            free_irq(nv->interrupt_line, (void *) nvl);
Lines 2063-2082 Link Here
2063
        nvl->tasklet.data = (unsigned long) nv;
2052
        nvl->tasklet.data = (unsigned long) nv;
2064
        tasklet_enable(&nvl->tasklet);
2053
        tasklet_enable(&nvl->tasklet);
2065
#if defined(CONFIG_XEN)
2066
        if ((nvl->dev->dma_mask <= 0xffffffff) &&
2067
            (HYPERVISOR_memory_op(XENMEM_maximum_ram_page, NULL) > 0xfffff))
2068
        {
2069
            NV_SHUTDOWN_ADAPTER(sp, nv, nvl);
2070
            nv_printf(NV_DBG_ERRORS,
2071
                "NVRM: GPUs incapable of addressing more than 4GB of memory\n"
2072
                "NVRM: are not supported when using Xen kernels on systems with\n"
2073
                "NVRM: system memory mapped above the 4GB boundary.\n");
2074
            rc = -EIO;
2075
            goto failed;
2076
        }
2077
#endif
2078
2079
        nv->flags |= NV_FLAG_OPEN;
2054
        nv->flags |= NV_FLAG_OPEN;
2080
    }
2055
    }
Lines 3944-3950 Link Here
3944
    U032         config
3919
    U032         config
3945
)
3920
)
3946
{
3921
{
3947
#if !defined(CONFIG_XEN)
3922
#if 1
3948
    RM_STATUS status = RM_ERROR;
3923
    RM_STATUS status = RM_ERROR;
3949
    static int old_error = 0;
3924
    static int old_error = 0;
3950
    nv_stack_t *sp = NULL;
3925
    nv_stack_t *sp = NULL;
(-)NVIDIA-Linux-x86_64-177.13-pkg2/usr/src/nv/os-interface.c (-5 / +5 lines)
Lines 48-54 Link Here
48
#endif
48
#endif
49
    local_bh_disable();
49
    local_bh_disable();
50
    atomic_set(&os_smp_barrier, 1);
50
    atomic_set(&os_smp_barrier, 1);
51
    ret = smp_call_function(ipi_handler, NULL, 1, 0);
51
    ret = NV_SMP_CALL_FUNCTION(ipi_handler, NULL, 1, 0);
52
#endif
52
#endif
53
    return (ret == 0) ? RM_OK : RM_ERROR;
53
    return (ret == 0) ? RM_OK : RM_ERROR;
54
}
54
}
Lines 609-615 Link Here
609
    if (jiffies)
609
    if (jiffies)
610
    {
610
    {
611
        // if we have at least 1 full jiffy to wait, give up the cpu
611
        // if we have at least 1 full jiffy to wait, give up the cpu
612
#if !defined(CONFIG_XEN)
612
#if 1
613
        // but first, make sure we haven't raised the irql level on
613
        // but first, make sure we haven't raised the irql level on
614
        // this cpu (most likely holding a lock). I'm seeing cases
614
        // this cpu (most likely holding a lock). I'm seeing cases
615
        // where we give up the cpu with raised irql, and never get
615
        // where we give up the cpu with raised irql, and never get
Lines 623-629 Link Here
623
#endif
623
#endif
624
            /* give up the cpu */
624
            /* give up the cpu */
625
            current->state = TASK_INTERRUPTIBLE;
625
            current->state = TASK_INTERRUPTIBLE;
626
#if !defined(CONFIG_XEN)
626
#if 1
627
        }
627
        }
628
        else
628
        else
629
        {
629
        {
Lines 700-706 Link Here
700
    U032 sig
700
    U032 sig
701
)
701
)
702
{
702
{
703
    return kill_proc(pid, sig, 1) ? RM_ERR_OPERATING_SYSTEM : RM_OK;
703
    return RM_OK;
704
}
704
}
705
/*******************************************************************************/
705
/*******************************************************************************/
Lines 1394-1400 Link Here
1394
     * If you prefer to manually grant the necessary capability and
1394
     * If you prefer to manually grant the necessary capability and
1395
     * adjust the resource limit, disable the lines below.
1395
     * adjust the resource limit, disable the lines below.
1396
     */
1396
     */
1397
#if !defined(CONFIG_XEN) && !defined(CONFIG_X86_4G)
1397
#if !defined(CONFIG_X86_4G)
1398
    struct rlimit *rlim = NV_TASK_STRUCT_RLIM(current);
1398
    struct rlimit *rlim = NV_TASK_STRUCT_RLIM(current);
1399
    rlim[RLIMIT_MEMLOCK].rlim_cur = RLIM_INFINITY;
1399
    rlim[RLIMIT_MEMLOCK].rlim_cur = RLIM_INFINITY;
1400
    cap_raise(current->cap_effective, CAP_IPC_LOCK);
1400
    cap_raise(current->cap_effective, CAP_IPC_LOCK);

Return to bug 235231